├── comprehension ├── find.cxx ├── hello.cxx ├── comprehension.cxx ├── any_of.cxx ├── for2.cxx ├── accumulate.cxx ├── filter.cxx ├── is_sorted.cxx ├── pack1.cxx ├── locus.cxx ├── count_if.cxx ├── pack_decl.cxx ├── count.cxx ├── locus2.cxx ├── palindrome.cxx ├── for_each.cxx ├── unique.cxx ├── for_each2.cxx ├── braced2.cxx ├── list_comp.cxx ├── range_for.cxx ├── build_all.sh ├── sequences.cxx ├── for.cxx └── slice4.cxx ├── embed ├── resources │ ├── test1.txt │ ├── test2.txt │ └── test3.txt ├── build_all.sh ├── embed1.cxx ├── gen_file.cxx └── embed5.cxx ├── examples ├── include │ └── util.hxx ├── kernel │ ├── build.sh │ ├── params.hxx │ ├── output1.txt │ ├── kernel.json │ └── output2.txt ├── hello │ ├── output.txt │ └── hello.cxx ├── special_errors.png ├── sfinae │ ├── output.txt │ └── sfinae.cxx ├── gpu │ ├── build_kernel1.sh │ └── build_kernel2.sh ├── format │ └── output.txt ├── variant │ ├── output.txt │ └── variant_layout2.cxx ├── serialize │ ├── output.txt │ └── output2.txt ├── scopes │ ├── output.txt │ └── scopes.cxx ├── duff │ ├── duff2.cxx │ ├── duff1.cxx │ └── duff3.cxx ├── fibonacci │ ├── output.txt │ └── fibonacci.cxx ├── enums │ ├── enums2.cxx │ └── enums.cxx ├── tuple │ └── tuple_layout2.cxx ├── language │ └── language.json └── special │ └── special.json ├── bloomberg_talk ├── series.txt ├── inject.json ├── index.md ├── reflect4.cxx ├── build_all.sh ├── reflect2.cxx ├── tuple1.cxx ├── reflect1.cxx ├── tuple3.cxx ├── meta3.cxx ├── meta1.cxx └── reflect3.cxx ├── video_walkthrough ├── series.txt ├── inject.json ├── schema.csv ├── reflect4.cxx ├── build_all.sh ├── reflect2.cxx ├── tuple1.cxx ├── reflect1.cxx ├── tuple3.cxx ├── meta3.cxx ├── meta1.cxx └── reflect3.cxx ├── regex ├── parse.cxx ├── error1.png ├── error2.png ├── sample.json ├── regex2.cxx ├── regex_lib.hxx ├── build_all.sh ├── regex.cxx └── string.cxx ├── fmt ├── test5.png ├── test6.png ├── build_all.sh ├── test5.cxx ├── test6.cxx ├── test1.cxx ├── test3.cxx └── test2.cxx ├── pattern ├── as.png ├── in.png ├── isas.png ├── isas2.png ├── isas3.png ├── generic.png ├── modulo.png ├── patterns.png ├── variant.png ├── constraint.cxx ├── build_all.sh ├── string2.cxx ├── string.cxx ├── modulo.cxx └── pattern2.cxx ├── variant ├── ctor.png ├── assign.png ├── compare.png ├── relational.png ├── in_place_type.png ├── compare.cxx ├── enum.cxx ├── select1.cxx └── select2.cxx ├── walkthrough ├── test.json ├── test2.json ├── options.json └── functions1.cxx ├── gems ├── rpn_errors.png ├── enum_to_name.cxx ├── name_to_enum.cxx └── taco1.cxx ├── imperative ├── life.gif ├── is_specialization2.cxx ├── info.cxx ├── rotate.cxx ├── print.cxx ├── step2.cxx ├── rotate2.cxx ├── step.cxx ├── get_args_cia.cxx ├── rebind.cxx ├── intro.cxx ├── forward.cxx ├── is_specialization.cxx ├── search.cxx ├── power.cxx ├── power2.cxx ├── unique.cxx ├── build_all.sh ├── search_traits.cxx ├── variant.cxx ├── group.cxx ├── repeat.cxx ├── sort3.cxx ├── pairs.cxx └── sort4.cxx ├── new-circle ├── val.png ├── gdb-choice.png ├── precedence.png ├── build_all.sh ├── carbon_proposals.png ├── tuple │ ├── build_all.sh │ ├── tuple4.cxx │ ├── build_benchmark_small.sh │ └── build_benchmark.sh ├── ctad2.cxx ├── nullptr.cxx ├── precedence.cxx ├── var2.cxx ├── var3.cxx ├── string_sort.cxx ├── format2.cxx ├── forward-old3.cxx ├── self.cxx ├── pointer_to_bool1.cxx ├── forward-old1.cxx ├── pack_index.cxx ├── subscript.cxx ├── lambda.cxx ├── most_vexing_parse2.cxx ├── safer_initializer_list.cxx ├── adl1.cxx ├── signed_overflow.cxx ├── ctor.cxx ├── most_vexing_parse.cxx ├── require_control_flow_braces.cxx ├── forward3.cxx ├── tuple2.cxx ├── forward2.cxx ├── backtick.cxx ├── format.cxx ├── index_sequence2.cxx ├── namespace.cxx ├── ctor_conversions.cxx ├── forward-old2.cxx ├── index_sequence.cxx ├── choice1.cxx ├── member_pack.cxx ├── single_argument.cxx ├── impl_test.cxx ├── ctad1.cxx ├── lifting4.cxx ├── forward-old4.cxx ├── choice3.cxx ├── lifting1.cxx ├── recurrence2.cxx ├── interface_template.cxx ├── overload3.cxx ├── impl_scope.cxx ├── pointer_to_bool2.cxx ├── member_pack2.cxx ├── enum_to_string.cxx ├── decl1.cxx ├── interface_template2.cxx ├── interface.cxx ├── tuple_like_of.cxx ├── sort2.cxx ├── switch_break.cxx ├── dyn.cxx ├── tuple1.cxx ├── carbon1.cxx ├── default_value_initialization.cxx ├── external_impl.cxx ├── forward1.cxx ├── polymorphism.cxx ├── placeholder.cxx ├── adl2.cxx ├── fn.cxx ├── recurrence1.cxx ├── interface_template3.cxx ├── choice2.cxx ├── choice4.cxx ├── print_impl.cxx ├── lifting3.cxx ├── ctad3.cxx └── adl3.cxx ├── reflection ├── error.png ├── reverse.cxx ├── two.cxx ├── enum1.cxx ├── one.cxx ├── enum_attrib2.cxx ├── access.cxx ├── attrib.cxx ├── types.json ├── type_name.cxx ├── boxers.json ├── build_all.sh ├── typed_enum1.cxx ├── typed_enum2.cxx └── json2.cxx ├── cuda ├── particles-cuda.png ├── particles-cuda2.png ├── targets.cxx ├── hello.cu ├── if_target.cxx ├── bad_launch.cxx ├── unique.cxx ├── storage_only.cxx ├── qsort.cxx └── vec.cxx ├── member-traits └── build_all.sh ├── new_whitepaper ├── inject.json ├── hello.cxx ├── build_all.sh ├── tuple.cxx ├── dynamic_names.cxx ├── serialization.cxx ├── typed_enums.cxx ├── typed_enums2.cxx ├── enums.cxx └── inject.cxx ├── packs ├── object3_error.png ├── locus.cxx ├── build_all.sh ├── object2.cxx ├── non_type.cxx ├── integer_pack.cxx ├── enum2.cxx ├── object3.cxx ├── pack_type.cxx ├── enum.cxx └── object.cxx ├── templates ├── build_all.sh ├── tuple1.cxx └── params1.cxx ├── stdlib ├── build_all.sh ├── mdspan1.cxx ├── tuple1.cxx ├── tuple_cat1.cxx └── tuple_cat2.cxx ├── conditional ├── call3.cxx ├── build_all.sh ├── call1.cxx ├── call_first.cxx ├── enum.cxx └── call2.cxx ├── universal ├── pack.cxx ├── build_all.sh ├── structured2.cxx ├── structured.cxx ├── transform.cxx ├── length.cxx ├── transform2.cxx └── pack2.cxx ├── type_provider └── schema.csv ├── deducing-this ├── two.cxx └── one.cxx ├── tuple ├── deduce.cxx ├── self.cxx └── access.cxx ├── erasure ├── func_decl1.cxx └── func_decl2.cxx └── macro └── macro.md /comprehension/find.cxx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /embed/resources/test1.txt: -------------------------------------------------------------------------------- 1 | This is test1.txt file -------------------------------------------------------------------------------- /embed/resources/test2.txt: -------------------------------------------------------------------------------- 1 | This is test2.txt file -------------------------------------------------------------------------------- /embed/resources/test3.txt: -------------------------------------------------------------------------------- 1 | This is test3.txt file -------------------------------------------------------------------------------- /examples/include/util.hxx: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | -------------------------------------------------------------------------------- /bloomberg_talk/series.txt: -------------------------------------------------------------------------------- 1 | 5 2 | 4 3 | 3 4 | 2 5 | 1 6 | -------------------------------------------------------------------------------- /video_walkthrough/series.txt: -------------------------------------------------------------------------------- 1 | 5 2 | 4 3 | 3 4 | 2 5 | 1 6 | -------------------------------------------------------------------------------- /regex/parse.cxx: -------------------------------------------------------------------------------- 1 | #define PCRE_LINKAGE 2 | #include "parse.inl" -------------------------------------------------------------------------------- /fmt/test5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/fmt/test5.png -------------------------------------------------------------------------------- /fmt/test6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/fmt/test6.png -------------------------------------------------------------------------------- /pattern/as.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/pattern/as.png -------------------------------------------------------------------------------- /pattern/in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/pattern/in.png -------------------------------------------------------------------------------- /examples/kernel/build.sh: -------------------------------------------------------------------------------- 1 | circle -M /usr/lib/x86_64-linux-gnu/liblua5.3.so kernel2.cxx -------------------------------------------------------------------------------- /pattern/isas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/pattern/isas.png -------------------------------------------------------------------------------- /pattern/isas2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/pattern/isas2.png -------------------------------------------------------------------------------- /pattern/isas3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/pattern/isas3.png -------------------------------------------------------------------------------- /regex/error1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/regex/error1.png -------------------------------------------------------------------------------- /regex/error2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/regex/error2.png -------------------------------------------------------------------------------- /variant/ctor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/variant/ctor.png -------------------------------------------------------------------------------- /walkthrough/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "F1" : "(x + y) / x", 3 | "F2" : "2 * x * sin(y)" 4 | } -------------------------------------------------------------------------------- /gems/rpn_errors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/gems/rpn_errors.png -------------------------------------------------------------------------------- /imperative/life.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/imperative/life.gif -------------------------------------------------------------------------------- /new-circle/val.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/new-circle/val.png -------------------------------------------------------------------------------- /pattern/generic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/pattern/generic.png -------------------------------------------------------------------------------- /pattern/modulo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/pattern/modulo.png -------------------------------------------------------------------------------- /pattern/patterns.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/pattern/patterns.png -------------------------------------------------------------------------------- /pattern/variant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/pattern/variant.png -------------------------------------------------------------------------------- /reflection/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/reflection/error.png -------------------------------------------------------------------------------- /variant/assign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/variant/assign.png -------------------------------------------------------------------------------- /variant/compare.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/variant/compare.png -------------------------------------------------------------------------------- /examples/hello/output.txt: -------------------------------------------------------------------------------- 1 | $ circle hello.cxx 2 | Hello circle 3 | $ ./hello 4 | Hello world 5 | -------------------------------------------------------------------------------- /variant/relational.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/variant/relational.png -------------------------------------------------------------------------------- /bloomberg_talk/inject.json: -------------------------------------------------------------------------------- 1 | { 2 | "sq" : "x * x", 3 | "unity" : "sq(sin(x)) + sq(cos(x))" 4 | } -------------------------------------------------------------------------------- /cuda/particles-cuda.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/cuda/particles-cuda.png -------------------------------------------------------------------------------- /cuda/particles-cuda2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/cuda/particles-cuda2.png -------------------------------------------------------------------------------- /member-traits/build_all.sh: -------------------------------------------------------------------------------- 1 | set -x 2 | circle traits1.cxx -std=c++20 3 | circle traits2.cxx -std=c++20 -------------------------------------------------------------------------------- /new-circle/gdb-choice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/new-circle/gdb-choice.png -------------------------------------------------------------------------------- /new-circle/precedence.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/new-circle/precedence.png -------------------------------------------------------------------------------- /new_whitepaper/inject.json: -------------------------------------------------------------------------------- 1 | { 2 | "sq" : "x * x", 3 | "unity" : "sq(sin(x)) + sq(cos(x))" 4 | } -------------------------------------------------------------------------------- /packs/object3_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/packs/object3_error.png -------------------------------------------------------------------------------- /templates/build_all.sh: -------------------------------------------------------------------------------- 1 | set -x 2 | circle params1.cxx -std=c++20 3 | circle tuple1.cxx -std=c++20 4 | -------------------------------------------------------------------------------- /variant/in_place_type.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/variant/in_place_type.png -------------------------------------------------------------------------------- /walkthrough/test2.json: -------------------------------------------------------------------------------- 1 | { 2 | "F3" : "sqrt(x * x + y * y)", 3 | "F4" : "(x > y) ? x : y" 4 | } 5 | -------------------------------------------------------------------------------- /examples/special_errors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/examples/special_errors.png -------------------------------------------------------------------------------- /video_walkthrough/inject.json: -------------------------------------------------------------------------------- 1 | { 2 | "sq" : "x * x", 3 | "unity" : "sq(sin(x)) + sq(cos(x))" 4 | } -------------------------------------------------------------------------------- /new-circle/build_all.sh: -------------------------------------------------------------------------------- 1 | set -x 2 | circle as.cxx 3 | circle ctor_conversions.cxx 4 | circle user_conversions.cxx -------------------------------------------------------------------------------- /new-circle/carbon_proposals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seanbaxter/circle/HEAD/new-circle/carbon_proposals.png -------------------------------------------------------------------------------- /examples/sfinae/output.txt: -------------------------------------------------------------------------------- 1 | $ circle sfinae.cxx 2 | $ ./sfinae 3 | Setting a_t obj.x = 1. 4 | a_t is big endian. 5 | b_t::y() called. 6 | -------------------------------------------------------------------------------- /new_whitepaper/hello.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | @meta printf("Hello circle\n"); 5 | printf("Hello world\n"); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /examples/gpu/build_kernel1.sh: -------------------------------------------------------------------------------- 1 | circle gpu1.cu -isystem /usr/local/cuda-9.2/include/ -L /usr/local/cuda-9.2/lib64 -l cudart --verbose -sm_35 -sm_52 -sm_70 -O0 --save-temps -------------------------------------------------------------------------------- /examples/gpu/build_kernel2.sh: -------------------------------------------------------------------------------- 1 | circle gpu2.cu -isystem /usr/local/cuda-9.2/include/ -L /usr/local/cuda-9.2/lib64 -l cudart --verbose -sm_35 -sm_52 -sm_70 -O0 --save-temps -------------------------------------------------------------------------------- /new-circle/tuple/build_all.sh: -------------------------------------------------------------------------------- 1 | set -x 2 | circle tuple1.cxx -std=c++20 3 | circle tuple2.cxx -std=c++20 4 | circle tuple3.cxx -std=c++20 5 | circle tuple4.cxx -std=c++20 6 | -------------------------------------------------------------------------------- /stdlib/build_all.sh: -------------------------------------------------------------------------------- 1 | set -x 2 | circle -std=c++20 tuple1.cxx && ./tuple1 3 | circle -std=c++20 variant1.cxx && ./variant1 4 | circle -std=c++20 extent1.cxx && ./extent1 5 | -------------------------------------------------------------------------------- /conditional/call3.cxx: -------------------------------------------------------------------------------- 1 | template int func(); 2 | 3 | int call(int index) { 4 | return int...(4) == index ...? func() : __builtin_unreachable(); 5 | } 6 | 7 | -------------------------------------------------------------------------------- /examples/hello/hello.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char** argv) { 4 | printf("Hello world\n"); 5 | @meta printf("Hello circle\n"); 6 | return 0; 7 | } -------------------------------------------------------------------------------- /variant/compare.cxx: -------------------------------------------------------------------------------- 1 | #include "variant.hxx" 2 | 3 | struct no_compare_t { }; 4 | 5 | int main() { 6 | circle::variant a, b; 7 | bool c = a < b; 8 | } 9 | -------------------------------------------------------------------------------- /universal/pack.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() { 5 | auto tuple = std::make_tuple('a', 2, 3.3); 6 | std::cout<< int...<< ": "<< tuple.[:]<< "\n" ...; 7 | } -------------------------------------------------------------------------------- /embed/build_all.sh: -------------------------------------------------------------------------------- 1 | set -x 2 | circle gen_file.cxx && ./gen_file 3 | time circle embed1.cxx 4 | time circle embed2.cxx 5 | time circle embed3.cxx 6 | time circle embed4.cxx 7 | time circle embed5.cxx -------------------------------------------------------------------------------- /fmt/build_all.sh: -------------------------------------------------------------------------------- 1 | set -x 2 | circle test1.cxx && ./test1 3 | circle test2.cxx && ./test2 4 | circle test3.cxx && ./test3 5 | circle test4.cxx && ./test4 6 | circle test5.cxx 7 | circle test6.cxx 8 | -------------------------------------------------------------------------------- /cuda/targets.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | // Print all PTX targets. 5 | std::cout<< nvvm_arch_t.enum_names<< " = " 6 | << (int)nvvm_arch_t.enum_values<< "\n" ...; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /fmt/test5.cxx: -------------------------------------------------------------------------------- 1 | #include "format.hxx" 2 | 3 | int main() { 4 | double x = M_PI / 2; 5 | 6 | // Create a syntax error in a format specifier. 7 | "x = {x:10.6r}\n"_print; 8 | 9 | return 0; 10 | } -------------------------------------------------------------------------------- /regex/sample.json: -------------------------------------------------------------------------------- 1 | { 2 | "phone number" : "([2-9]\\d{2})-(\\d{3})-(\\d{4})", 3 | "social security number" : "(\\d{3})-(\\d{2})-(\\d{4})", 4 | "zip code" : "(\\d{5})-(\\d{4})?" 5 | } -------------------------------------------------------------------------------- /comprehension/hello.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() { 5 | std::string s = "hello"; 6 | std::cout<< s[:]<< ' ' ...; // Prints 'h e l l o ' 7 | std::cout<< '\n'; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /reflection/reverse.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | template 4 | struct reverse_t { 5 | types_t...[::-1] @(int...) ...; 6 | }; 7 | 8 | @meta puts(@member_decl_strings(reverse_t))...; -------------------------------------------------------------------------------- /bloomberg_talk/index.md: -------------------------------------------------------------------------------- 1 | Taylor series from file. Then add two meta tokens to make compile-time. 2 | 3 | git hash index example. Illustrate @string as mechanism to marshal data. 4 | 5 | 6 | 7 | Reflection. Use parameter packs? -------------------------------------------------------------------------------- /examples/format/output.txt: -------------------------------------------------------------------------------- 1 | $ circle format.cxx 2 | $ ./format 3 | My vector is { x : 1, y : 1.5, z : 1.8e-12 }. 4 | My tuple is { _0 : a tuple's string, _1 : 3.14159, _2 : q }. 5 | My heroes are { _0 : Frank, _1 : Whatley }. 6 | -------------------------------------------------------------------------------- /imperative/is_specialization2.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using T1 = std::tuple; 4 | using T2 = std::pair; 5 | 6 | static_assert(T1.template == std::tuple); 7 | static_assert(T2.template != std::tuple); 8 | -------------------------------------------------------------------------------- /examples/variant/output.txt: -------------------------------------------------------------------------------- 1 | $ circle variant.cxx 2 | $ ./variant 3 | int: 100 4 | 5 | int: 100 6 | double: 3.14 7 | var<1> = 3.14 8 | int: 15 9 | std::vector: [ 100, 200 ] 10 | vec3_t: { x : 5, y : 6, z : 7 } 11 | -------------------------------------------------------------------------------- /new-circle/ctad2.cxx: -------------------------------------------------------------------------------- 1 | template 2 | struct foo_t { 3 | X x; 4 | Y y; 5 | Z z; 6 | }; 7 | 8 | int main() { 9 | #pragma feature no_aggregate_deduction 10 | foo_t obj { 1, 2, 3 }; 11 | } -------------------------------------------------------------------------------- /new-circle/nullptr.cxx: -------------------------------------------------------------------------------- 1 | void func(const int*); 2 | 3 | int main() { 4 | func(nullptr); // OK 5 | func(0); // OK 6 | 7 | #feature on no_zero_nullptr 8 | func(nullptr); // OK 9 | func(0); // Error 10 | } -------------------------------------------------------------------------------- /type_provider/schema.csv: -------------------------------------------------------------------------------- 1 | DateTime,Latitude,Longitude,Depth,Magnitude,MagType,NbStations,Gap,Distance,RMS,Source,EventID 2 | 1970/01/04 17:00:40.20,24.138999999999900,102.503000000000000,31.00,7.50,Ms,90,,,0.000000000000000,NEI,1970010440 3 | -------------------------------------------------------------------------------- /new-circle/precedence.cxx: -------------------------------------------------------------------------------- 1 | int main() { 2 | const int mask = 0x07; 3 | const int value = 0x03; 4 | 5 | static_assert(3 != mask & value); 6 | 7 | #feature on simpler_precedence 8 | 9 | static_assert(3 == mask & value); 10 | } -------------------------------------------------------------------------------- /video_walkthrough/schema.csv: -------------------------------------------------------------------------------- 1 | DateTime,Latitude,Longitude,Depth,Magnitude,MagType,NbStations,Gap,Distance,RMS,Source,EventID 2 | 1970/01/04 17:00:40.20,24.138999999999900,102.503000000000000,31.00,7.50,Ms,90,,,0.000000000000000,NEI,1970010440 3 | -------------------------------------------------------------------------------- /conditional/build_all.sh: -------------------------------------------------------------------------------- 1 | set -x 2 | circle call1.cxx && ./call1 3 | circle call2.cxx && ./call2 4 | circle call3.cxx -S -emit-llvm && cat call3.ll 5 | circle enum.cxx && ./enum 6 | circle call_first.cxx && ./call_first 7 | circle visit.cxx && ./visit -------------------------------------------------------------------------------- /new-circle/var2.cxx: -------------------------------------------------------------------------------- 1 | #pragma feature new_decl_syntax 2 | #include 3 | 4 | struct S { 5 | var x : int; 6 | var y : int; 7 | var z : int; 8 | }; 9 | 10 | int main() { 11 | var [x, y, z] := S { 1, 2, 3 }; 12 | printf("%d %d %d\n", x, y, z); 13 | } -------------------------------------------------------------------------------- /cuda/hello.cu: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | __global__ void my_kernel() { 5 | int tid = threadIdx.x; 6 | printf("Hello CUDA %d.\n", tid); 7 | } 8 | 9 | int main() { 10 | my_kernel<<<1, 8>>>(); 11 | cudaDeviceSynchronize(); 12 | } 13 | -------------------------------------------------------------------------------- /comprehension/comprehension.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() { 5 | std::vector v = [ for i : @range(1:6)... => for i2 : i => i ... ... ]; 6 | 7 | // Prints '1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 '. 8 | printf("%d ", v[:])...; printf("\n"); 9 | } 10 | -------------------------------------------------------------------------------- /examples/serialize/output.txt: -------------------------------------------------------------------------------- 1 | $ circle serialize.cxx 2 | $ ./serialize 3 | struct1_t { 4 | char c: "X" 5 | double d: "3.14159" 6 | const char* s: "A C string" 7 | } 8 | struct2_t { 9 | std::string string: "A C++ string" 10 | long l: "42" 11 | bool b: "1" 12 | } 13 | -------------------------------------------------------------------------------- /new-circle/var3.cxx: -------------------------------------------------------------------------------- 1 | #pragma feature new_decl_syntax 2 | #include 3 | 4 | int main() { 5 | var array : int[] { 1, 2, 3, 4 }; 6 | var sum := 0; 7 | 8 | for(var x in array) { 9 | printf("%d\n", x); 10 | sum += x; 11 | } 12 | 13 | printf("%d\n", sum); 14 | } -------------------------------------------------------------------------------- /new-circle/string_sort.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | enum class shapes_t { 4 | circle, 5 | triangle, 6 | square, 7 | pentagon, 8 | hexagon, 9 | septagon, 10 | octagon, 11 | }; 12 | 13 | int main() { 14 | std::cout<< shapes_t~enum_names~sort(_1 < _2) + "\n" ...; 15 | } -------------------------------------------------------------------------------- /packs/locus.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | template 4 | void print_args(const args_t&... x) { 5 | // Note the trailing ... in the expression. 6 | std::cout<< x<< "\n" ...; 7 | } 8 | 9 | int main() { 10 | print_args(1, 3.14, "Hello"); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /bloomberg_talk/reflect4.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct foo_t { 4 | int x; 5 | double y; 6 | float z; 7 | short w; 8 | }; 9 | 10 | int main() { 11 | foo_t obj { 2, 3, 4, 5 }; 12 | double x = (... + @member_values(obj)); 13 | printf("x = %f\n", x); 14 | 15 | return 0; 16 | } -------------------------------------------------------------------------------- /video_walkthrough/reflect4.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct foo_t { 4 | int x; 5 | double y; 6 | float z; 7 | short w; 8 | }; 9 | 10 | int main() { 11 | foo_t obj { 2, 3, 4, 5 }; 12 | double x = (... + @member_values(obj)); 13 | printf("x = %f\n", x); 14 | 15 | return 0; 16 | } -------------------------------------------------------------------------------- /fmt/test6.cxx: -------------------------------------------------------------------------------- 1 | #include "format.hxx" 2 | 3 | struct foo_t; 4 | 5 | int main() { 6 | // Try to print a pointer-to-member function. It's not supported! 7 | int(foo_t::*pmf)(double, int) = nullptr; 8 | 9 | // Get a nice error here. 10 | "pointer-to-member pmf = {pmf}\n"_print; 11 | 12 | return 0; 13 | } -------------------------------------------------------------------------------- /imperative/info.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | template 5 | using ReplicateArgs = T.template< 6 | .{ T.type_args }(int... + 1) ... 7 | >; 8 | 9 | using T1 = std::tuple; 10 | using T2 = ReplicateArgs; 11 | 12 | @meta std::cout<< T2.string<< "\n"; -------------------------------------------------------------------------------- /new-circle/format2.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | template 4 | void func() { 5 | static_assert( 6 | Ts~is_arithmetic, 7 | "parameter {0}, type {1}, is not arithmetic".format(int..., Ts~string) 8 | ) ...; 9 | } 10 | 11 | int main() { 12 | func(); 13 | } -------------------------------------------------------------------------------- /imperative/rotate.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | template 4 | using Rotate = T.template< 5 | T.universal_args...[N:]..., T.universal_args...[:N]... 6 | >; 7 | 8 | using T1 = std::tuple; 9 | 10 | static_assert(std::tuple == Rotate<2, T1>); -------------------------------------------------------------------------------- /new-circle/forward-old3.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct pair_t { 4 | int first; 5 | double second; 6 | }; 7 | 8 | void func(auto&& obj) { 9 | std::cout<< decltype(obj)~string + "\n"; 10 | std::cout<< decltype(obj.first)~string + "\n"; 11 | } 12 | 13 | int main() { 14 | pair_t pair { 1, 2 }; 15 | func(pair); 16 | } -------------------------------------------------------------------------------- /regex/regex2.cxx: -------------------------------------------------------------------------------- 1 | #include "eval.hxx" 2 | #include "parse.inl" 3 | 4 | int main() { 5 | const char* text = "gray"; 6 | if(auto match = pcre::match_regex<"gr[ae]y", true>(text)) { 7 | printf("Input matches pattern\n"); 8 | 9 | } else { 10 | printf("Input doesn't match pattern\n"); 11 | } 12 | 13 | return 0; 14 | } -------------------------------------------------------------------------------- /conditional/call1.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void call(auto f, const auto& x) { 4 | requires { f(x); } ?? 5 | std::cout<< f(x)<< "\n" : 6 | std::cout<< "Could not call f("<< @type_string(decltype(x))<< ")\n"; 7 | } 8 | 9 | int f(int x) { return x * x; } 10 | 11 | int main() { 12 | call(f, 5); 13 | call(f, "Hello"); 14 | } -------------------------------------------------------------------------------- /embed/embed1.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | const char* filename = "test_binary.data"; 4 | const int data[] = @embed(int, filename); 5 | 6 | @meta printf("data has %zu bytes\n", sizeof(data)); 7 | 8 | int main() { 9 | // Use it or lose it. 10 | for(int x : data) 11 | printf("%d\n", x); 12 | 13 | return 0; 14 | } 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /packs/build_all.sh: -------------------------------------------------------------------------------- 1 | set -x 2 | circle enum.cxx && ./enum 3 | circle enum2.cxx && ./enum2 4 | circle integer_pack.cxx && ./integer_pack 5 | circle locus.cxx && ./locus 6 | circle non_type.cxx && ./non_type 7 | circle object.cxx && ./object 8 | circle object2.cxx && ./object2 9 | circle object3.cxx && ./object3 10 | circle pack_type.cxx && ./pack_type -------------------------------------------------------------------------------- /new-circle/self.cxx: -------------------------------------------------------------------------------- 1 | #pragma feature self 2 | 3 | struct foo_t { 4 | void func() { 5 | self.x += 10; // OK! 6 | this->x += 10; // Error 7 | } 8 | 9 | // Take an explicit object by using the 'self' parameter name. 10 | template 11 | void func2(T self) { 12 | self.x = 1; 13 | } 14 | 15 | int x = 10; 16 | }; -------------------------------------------------------------------------------- /cuda/if_target.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | __global__ void kernel() { 5 | @meta for enum(nvvm_arch_t arch : nvvm_arch_t) { 6 | if target(arch == __nvvm_arch) 7 | printf("Compiling kernel for %s\n", arch.string); 8 | } 9 | } 10 | 11 | int main() { 12 | kernel<<<1, 1>>>(); 13 | cudaDeviceSynchronize(); 14 | } -------------------------------------------------------------------------------- /imperative/print.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | template 5 | void print_type() { 6 | std::cout<< T.string<< "\n"; 7 | std::cout<< T.template.string<< "\n"; 8 | std::cout<< int...<< ": "<< T.type_args.string<< "\n" ...; 9 | } 10 | 11 | int main() { 12 | print_type>(); 13 | } -------------------------------------------------------------------------------- /new-circle/pointer_to_bool1.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void func(const std::string& s) { 5 | std::cout<< s<< "\n"; 6 | } 7 | 8 | void func(bool b) { 9 | std::cout<< (b ? "true" : "false") << "\n"; 10 | } 11 | 12 | int main() { 13 | // Prints "true"!!! We wanted the std::string overload! 14 | func("Hello world!"); 15 | } -------------------------------------------------------------------------------- /imperative/step2.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | template 4 | using index_and_arg = T.template< 5 | T.template... 6 | >; 7 | 8 | template