├── .appveyor.yml ├── .gitignore ├── .travis.yml ├── CMakeLists.txt ├── LICENSE.md ├── README.md ├── benchmark ├── CMakeLists.txt ├── dependencies │ ├── brigand.cmake │ ├── fusion.cmake │ ├── hana.cmake │ ├── kvasir.cmake │ ├── meta.cmake │ ├── metal.cmake │ ├── mp11.cmake │ ├── mpl.cmake │ ├── std.cmake │ └── tmp.cmake ├── hetero │ ├── at │ │ ├── CMakeLists.txt │ │ ├── fusion.list.cpp.erb │ │ ├── fusion.vector.cpp.erb │ │ ├── hana.basic_tuple.cpp.erb │ │ ├── hana.tuple.cpp.erb │ │ └── std.tuple.cpp.erb │ ├── at_key │ │ ├── CMakeLists.txt │ │ ├── fusion.map.cpp.erb │ │ ├── hana.map.cpp.erb │ │ └── hana.tuple.cpp.erb │ ├── cartesian_product │ │ ├── CMakeLists.txt │ │ └── hana.tuple.cpp.erb │ ├── count_if │ │ ├── CMakeLists.txt │ │ ├── fusion.list.cpp.erb │ │ ├── fusion.vector.cpp.erb │ │ └── hana.tuple.cpp.erb │ ├── difference │ │ ├── CMakeLists.txt │ │ └── hana.set.cpp.erb │ ├── filter │ │ ├── CMakeLists.txt │ │ ├── fusion.list.cpp.erb │ │ ├── fusion.vector.cpp.erb │ │ ├── hana.tuple.cpp.erb │ │ └── tmp.pack.cpp.erb │ ├── find_if │ │ ├── CMakeLists.txt │ │ ├── fusion.list.cpp.erb │ │ ├── fusion.vector.cpp.erb │ │ ├── hana.map.cpp.erb │ │ ├── hana.set.cpp.erb │ │ ├── hana.tuple.cpp.erb │ │ └── tmp.pack.cpp.erb │ ├── fold_left │ │ ├── CMakeLists.txt │ │ ├── fusion.list.cpp.erb │ │ ├── fusion.vector.cpp.erb │ │ ├── hana.basic_tuple.cpp.erb │ │ └── hana.tuple.cpp.erb │ ├── fold_right │ │ ├── CMakeLists.txt │ │ ├── fusion.vector.cpp.erb │ │ ├── hana.basic_tuple.cpp.erb │ │ └── hana.tuple.cpp.erb │ ├── insert │ │ ├── CMakeLists.txt │ │ ├── hana.map.cpp.erb │ │ └── hana.set.cpp.erb │ ├── intersection │ │ ├── CMakeLists.txt │ │ └── hana.set.cpp.erb │ ├── is_disjoint │ │ ├── CMakeLists.txt │ │ ├── hana.map.cpp.erb │ │ ├── hana.set.cpp.erb │ │ └── hana.tuple.cpp.erb │ ├── is_subset │ │ ├── CMakeLists.txt │ │ ├── hana.map.cpp.erb │ │ ├── hana.set.cpp.erb │ │ └── hana.tuple.cpp.erb │ ├── lexicographical_compare │ │ ├── CMakeLists.txt │ │ └── hana.tuple.cpp.erb │ ├── make │ │ ├── CMakeLists.txt │ │ ├── fusion.list.cpp.erb │ │ ├── fusion.map.cpp.erb │ │ ├── fusion.set.cpp.erb │ │ ├── fusion.vector.cpp.erb │ │ ├── hana.basic_tuple.cpp.erb │ │ ├── hana.map.cpp.erb │ │ ├── hana.set.cpp.erb │ │ ├── hana.tuple.cpp.erb │ │ ├── std.array.cpp.erb │ │ ├── std.tuple.cpp.erb │ │ └── tmp.pack.cpp.erb │ ├── partition │ │ ├── CMakeLists.txt │ │ └── hana.tuple.cpp.erb │ ├── sort │ │ ├── CMakeLists.txt │ │ └── hana.tuple.cpp.erb │ ├── symmetric_difference │ │ ├── CMakeLists.txt │ │ └── hana.set.cpp.erb │ ├── transform │ │ ├── CMakeLists.txt │ │ ├── fusion.list.cpp.erb │ │ ├── fusion.vector.cpp.erb │ │ ├── hana.basic_tuple.cpp.erb │ │ └── hana.tuple.cpp.erb │ ├── union │ │ ├── CMakeLists.txt │ │ └── hana.set.cpp.erb │ └── unpack │ │ ├── CMakeLists.txt │ │ ├── fusion.list.cpp.erb │ │ ├── fusion.vector.cpp.erb │ │ ├── hana.basic_tuple.cpp.erb │ │ ├── hana.set.cpp.erb │ │ └── hana.tuple.cpp.erb └── type │ ├── all │ ├── CMakeLists.txt │ ├── brigand.list.cpp.erb │ ├── kvasir.list.cpp.erb │ ├── meta.list.cpp.erb │ ├── metal.list.cpp.erb │ ├── mp11.list.cpp.erb │ └── tmp.list.cpp.erb │ ├── any │ ├── CMakeLists.txt │ ├── brigand.list.cpp.erb │ ├── kvasir.list.cpp.erb │ ├── meta.list.cpp.erb │ ├── metal.list.cpp.erb │ └── mp11.list.cpp.erb │ ├── at │ ├── CMakeLists.txt │ ├── brigand.list.cpp.erb │ ├── hana.types.cpp.erb │ ├── kvasir.list.cpp.erb │ ├── meta.list.cpp.erb │ ├── metal.list.cpp.erb │ ├── mp11.list.cpp.erb │ ├── mpl.list.cpp.erb │ └── mpl.vector.cpp.erb │ ├── cartesian_product │ ├── CMakeLists.txt │ ├── kvasir.list.cpp.erb │ ├── meta.list.cpp.erb │ ├── metal.list.cpp.erb │ └── mp11.list.cpp.erb │ ├── count_if │ ├── CMakeLists.txt │ ├── brigand.list.cpp.erb │ ├── kvasir.list.cpp.erb │ ├── meta.list.cpp.erb │ ├── metal.list.cpp.erb │ ├── mp11.list.cpp.erb │ ├── mpl.list.cpp.erb │ └── mpl.vector.cpp.erb │ ├── distinct │ ├── CMakeLists.txt │ ├── metal.list.cpp.erb │ └── mp11.list.cpp.erb │ ├── drop │ ├── CMakeLists.txt │ ├── brigand.list.cpp.erb │ ├── kvasir.list.cpp.erb │ ├── meta.list.cpp.erb │ ├── metal.list.cpp.erb │ └── mp11.list.cpp.erb │ ├── erase │ ├── CMakeLists.txt │ ├── brigand.list.cpp.erb │ ├── kvasir.list.cpp.erb │ ├── metal.list.cpp.erb │ ├── mp11.list.cpp.erb │ ├── mpl.list.cpp.erb │ └── mpl.vector.cpp.erb │ ├── filter │ ├── CMakeLists.txt │ ├── brigand.list.cpp.erb │ ├── kvasir.list.cpp.erb │ ├── meta.list.cpp.erb │ ├── metal.list.cpp.erb │ ├── mp11.list.cpp.erb │ ├── mpl.list.cpp.erb │ ├── mpl.vector.cpp.erb │ └── tmp.list.cpp.erb │ ├── find_if │ ├── CMakeLists.txt │ ├── brigand.list.cpp.erb │ ├── hana.std_integer_sequence.cpp.erb │ ├── kvasir.list.cpp.erb │ ├── meta.list.cpp.erb │ ├── metal.list.cpp.erb │ ├── mp11.list.cpp.erb │ ├── mpl.list.cpp.erb │ ├── mpl.vector.cpp.erb │ └── tmp.list.cpp.erb │ ├── fold_left │ ├── CMakeLists.txt │ ├── brigand.list.cpp.erb │ ├── kvasir.list.cpp.erb │ ├── meta.list.cpp.erb │ ├── metal.list.cpp.erb │ ├── mp11.list.cpp.erb │ ├── mpl.list.cpp.erb │ └── mpl.vector.cpp.erb │ ├── fold_right │ ├── CMakeLists.txt │ ├── brigand.list.cpp.erb │ ├── kvasir.list.cpp.erb │ ├── meta.list.cpp.erb │ ├── metal.list.cpp.erb │ ├── mp11.list.cpp.erb │ ├── mpl.list.cpp.erb │ └── mpl.vector.cpp.erb │ ├── insert │ ├── CMakeLists.txt │ ├── kvasir.list.cpp.erb │ ├── metal.list.cpp.erb │ ├── mp11.list.cpp.erb │ ├── mpl.list.cpp.erb │ └── mpl.vector.cpp.erb │ ├── join │ ├── CMakeLists.txt │ ├── brigand.list.cpp.erb │ ├── kvasir.list.cpp.erb │ ├── meta.list.cpp.erb │ ├── metal.list.cpp.erb │ ├── mp11.list.cpp.erb │ └── tmp.list.cpp.erb │ ├── make │ ├── CMakeLists.txt │ ├── brigand.list.cpp.erb │ ├── hana.types.cpp.erb │ ├── kvasir.list.cpp.erb │ ├── meta.list.cpp.erb │ ├── metal.list.cpp.erb │ ├── mp11.list.cpp.erb │ ├── mpl.list.cpp.erb │ └── mpl.vector.cpp.erb │ ├── partition │ ├── CMakeLists.txt │ ├── brigand.list.cpp.erb │ ├── kvasir.list.cpp.erb │ ├── meta.list.cpp.erb │ ├── metal.list.cpp.erb │ ├── mp11.list.cpp.erb │ ├── mpl.list.cpp.erb │ └── mpl.vector.cpp.erb │ ├── replace_if │ ├── CMakeLists.txt │ ├── brigand.list.cpp.erb │ ├── hana.types.cpp.erb │ ├── kvasir.list.cpp.erb │ ├── meta.list.cpp.erb │ ├── metal.list.cpp.erb │ ├── mp11.list.cpp.erb │ ├── mpl.list.cpp.erb │ └── mpl.vector.cpp.erb │ ├── reverse │ ├── CMakeLists.txt │ ├── brigand.list.cpp.erb │ ├── kvasir.list.cpp.erb │ ├── meta.list.cpp.erb │ ├── metal.list.cpp.erb │ ├── mp11.list.cpp.erb │ ├── mpl.list.cpp.erb │ └── mpl.vector.cpp.erb │ ├── sort │ ├── CMakeLists.txt │ ├── brigand.list.cpp.erb │ ├── kvasir.list.cpp.erb │ ├── meta.list.cpp.erb │ ├── metal.list.cpp.erb │ ├── mp11.list.cpp.erb │ ├── mpl.list.cpp.erb │ └── mpl.vector.cpp.erb │ ├── take │ ├── CMakeLists.txt │ ├── brigand.list.cpp.erb │ ├── kvasir.list.cpp.erb │ ├── metal.list.cpp.erb │ └── mp11.list.cpp.erb │ └── transform │ ├── CMakeLists.txt │ ├── brigand.list.cpp.erb │ ├── hana.types.cpp.erb │ ├── kvasir.list.cpp.erb │ ├── meta.list.cpp.erb │ ├── metal.list.cpp.erb │ ├── mp11.list.cpp.erb │ ├── mpl.list.cpp.erb │ └── mpl.vector.cpp.erb ├── example ├── CMakeLists.txt ├── decay │ ├── my_decay.cpp.erb │ └── std_decay.cpp.erb └── make_tuple │ ├── recursive_tuple.cpp.erb │ └── std_tuple.cpp.erb ├── metabench.cmake ├── test ├── CMakeLists.txt ├── add_chart_all_target │ ├── CMakeLists.txt │ └── a_template_file_with_a_very_unique_name.cpp.erb ├── add_chart_aspect_link_time │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── add_chart_aspect_peak_memory │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── add_chart_aspect_size │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── add_chart_custom_look │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── add_chart_custom_output │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── add_chart_custom_output_absolute │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── add_chart_default_output │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── add_dataset_absolute_erb │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── add_dataset_ctest_target │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── add_dataset_custom_output │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── add_dataset_custom_output_absolute │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── add_dataset_custom_properties │ ├── CMakeLists.txt │ ├── dummy1.cpp.erb │ └── dummy2.cpp.erb ├── add_dataset_default_output │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── add_dataset_generate_with_custom_rule │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── add_dataset_median_of │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── add_dataset_nested_directories │ ├── CMakeLists.txt │ └── path │ │ └── to │ │ └── benchmark │ │ └── dummy.cpp.erb ├── dataset_and_template_differ │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── dataset_properties_on_ctest_targets │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── env │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── local_header │ ├── CMakeLists.txt │ ├── dummy.cpp.erb │ └── local_header.hpp ├── n │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── one_template_many_datasets │ ├── CMakeLists.txt │ └── dummy.cpp.erb ├── path contains spaces │ ├── CMakeLists.txt │ └── dummy.cpp.erb └── should_fail_on_compilation_error │ ├── CMakeLists.txt │ └── dummy.cpp.erb └── tools └── cmake_escape.sh /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | _site/ 3 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | cmake_minimum_required(VERSION 3.1) 6 | 7 | project(Metabench CXX) 8 | 9 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) 10 | include(metabench) 11 | 12 | enable_testing() 13 | 14 | add_subdirectory(benchmark) 15 | add_subdirectory(example) 16 | add_subdirectory(test) 17 | -------------------------------------------------------------------------------- /benchmark/dependencies/std.cmake: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19") 6 | message(STATUS "The compiler has an unsupported standard library - standard library will be unavailable.") 7 | 8 | function(Std_add_dataset) 9 | endfunction() 10 | else() 11 | function(Std_add_dataset dataset datatype) 12 | if("${datatype}" STREQUAL "tuple") 13 | set(color "hsl(118, 41%, 49%)") 14 | elseif("${datatype}" STREQUAL "array") 15 | set(color "hsl(118, 41%, 69%)") 16 | else() 17 | message(FATAL_ERROR "Unknown datatype '${datatype}' in the standard library") 18 | endif() 19 | metabench_add_dataset(${dataset} ${ARGN} COLOR ${color}) 20 | endfunction() 21 | endif() 22 | -------------------------------------------------------------------------------- /benchmark/hetero/at/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero at fusion list fusion.list.cpp.erb 3 "(0..50).step(10).to_a" "p\;100") 7 | add_dataset(datasets hetero at fusion vector fusion.vector.cpp.erb 3 "(0..50).step(10).to_a + (100..100).step(50).to_a" "p\;100") 8 | add_dataset(datasets hetero at hana basic_tuple hana.basic_tuple.cpp.erb 3 "(0..50).step(10).to_a + (100..300).step(50).to_a" "p\;100") 9 | add_dataset(datasets hetero at hana tuple hana.tuple.cpp.erb 3 "(0..50).step(10).to_a + (100..300).step(50).to_a" "p\;100") 10 | add_dataset(datasets hetero at std tuple std.tuple.cpp.erb 3 "(0..50).step(10).to_a + (100..100).step(50).to_a" "p\;100") 11 | 12 | add_chart(hetero at DATASETS ${datasets}) 13 | -------------------------------------------------------------------------------- /benchmark/hetero/at/fusion.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | namespace fusion = boost::fusion; 8 | 9 | template struct x {}; 10 | 11 | int main() { 12 | <% env[:k].times do |k| %> 13 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_list( 14 | <%= ((k*n+1)..(k*n+n)).map { |n| "x<#{n}>()" }.join(', ') %> 15 | ); 16 | 17 | <% (env[:p]*n/100).times do |p| %> 18 | #if defined(METABENCH) 19 | fusion::at_c<<%= p*100/env[:p] %>>(<%= "xs#{k}" %>); 20 | #endif 21 | <% end %> 22 | <% end %> 23 | } 24 | -------------------------------------------------------------------------------- /benchmark/hetero/at/fusion.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | namespace fusion = boost::fusion; 8 | 9 | template struct x {}; 10 | 11 | int main() { 12 | <% env[:k].times do |k| %> 13 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_vector( 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>()" }.join(', ') %> 15 | ); 16 | 17 | <% (env[:p]*n/100).times do |p| %> 18 | #if defined(METABENCH) 19 | fusion::at_c<<%= p*100/env[:p] %>>(<%= "xs#{k}" %>); 20 | #endif 21 | <% end %> 22 | <% end %> 23 | } 24 | -------------------------------------------------------------------------------- /benchmark/hetero/at/hana.basic_tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace hana = boost::hana; 7 | 8 | template struct x {}; 9 | 10 | int main() { 11 | <% env[:k].times do |k| %> 12 | constexpr auto <%= "xs#{k}" %> = hana::make_basic_tuple( 13 | <%= ((k*n+1)..(k*n+n)).map { |n| "x<#{n}>{}" }.join(', ') %> 14 | ); 15 | 16 | <% (env[:p]*n/100).times do |p| %> 17 | #if defined(METABENCH) 18 | constexpr auto <%= "result#{p}#{k}" %> = hana::at_c<<%= p*100/env[:p] %>>(<%= "xs#{k}" %>); 19 | #endif 20 | <% end %> 21 | <% end %> 22 | } 23 | -------------------------------------------------------------------------------- /benchmark/hetero/at/hana.tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | namespace hana = boost::hana; 8 | 9 | template struct x {}; 10 | 11 | int main() { 12 | <% env[:k].times do |k| %> 13 | constexpr auto <%= "xs#{k}" %> = hana::make_tuple( 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 15 | ); 16 | 17 | <% (env[:p]*n/100).times do |p| %> 18 | #if defined(METABENCH) 19 | constexpr auto <%= "result#{p}#{k}" %> = hana::at_c<<%= p*100/env[:p] %>>(<%= "xs#{k}" %>); 20 | #endif 21 | <% end %> 22 | <% end %> 23 | } 24 | -------------------------------------------------------------------------------- /benchmark/hetero/at/std.tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template struct x {}; 8 | 9 | int main() { 10 | <% env[:k].times do |k| %> 11 | constexpr auto <%= "xs#{k}" %> = std::make_tuple( 12 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 13 | ); 14 | 15 | <% (env[:p]*n/100).times do |p| %> 16 | #if defined(METABENCH) 17 | constexpr auto <%= "result#{p}#{k}" %> = std::get<<%= p*100/env[:p] %>>(<%= "xs#{k}" %>); 18 | #endif 19 | <% end %> 20 | <% end %> 21 | } 22 | -------------------------------------------------------------------------------- /benchmark/hetero/at_key/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero at_key fusion map fusion.map.cpp.erb 1 "(0..50).step(10).to_a + (100..100).step(50).to_a" "p\;15") 7 | add_dataset(datasets hetero at_key hana map hana.map.cpp.erb 1 "(0..50).step(10).to_a + (100..300).step(50).to_a" "p\;15") 8 | add_dataset(datasets hetero at_key hana tuple hana.tuple.cpp.erb 1 "(0..50).step(10).to_a + (100..200).step(50).to_a" "p\;15") 9 | 10 | add_chart(hetero at_key DATASETS ${datasets}) 11 | -------------------------------------------------------------------------------- /benchmark/hetero/at_key/fusion.map.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | namespace fusion = boost::fusion; 9 | namespace mpl = boost::mpl; 10 | 11 | struct undefined {}; 12 | 13 | int main() { 14 | <% env[:k].times do |k| %> 15 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_map< 16 | <%= ((k*n+1)..(k*n+n)).map { |i| "mpl::int_<#{i}>" }.join(', ') %> 17 | >( 18 | <%= ((k*n+1)..(k*n+n)).map { |i| "undefined{}" }.join(', ') %> 19 | ); 20 | 21 | <% (env[:p]*n/100).times do |p| %> 22 | #if defined(METABENCH) 23 | /*constexpr*/ auto <%= "result#{p}#{k}" %> = fusion::at_key>>(<%= "xs#{k}" %>); 24 | #endif 25 | <% end %> 26 | <% end %> 27 | } 28 | -------------------------------------------------------------------------------- /benchmark/hetero/at_key/hana.tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | namespace hana = boost::hana; 9 | 10 | int main() { 11 | <% env[:k].times do |k| %> 12 | constexpr auto <%= "xs#{k}" %> = hana::make_tuple( 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "hana::int_<#{i}>{}" }.join(', ') %> 14 | ); 15 | 16 | <% (env[:p]*n/100).times do |p| %> 17 | #if defined(METABENCH) 18 | constexpr auto <%= "result#{p}#{k}" %> = hana::at_key(<%= "xs#{k}" %>, hana::int_<<%= k*n+p*100/env[:p]+1 %>>{}); 19 | #endif 20 | <% end %> 21 | <% end %> 22 | } 23 | -------------------------------------------------------------------------------- /benchmark/hetero/cartesian_product/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero cartesian_product hana tuple hana.tuple.cpp.erb 1 "(0..30).step(5)") 7 | 8 | add_chart(hetero cartesian_product DATASETS ${datasets}) 9 | -------------------------------------------------------------------------------- /benchmark/hetero/cartesian_product/hana.tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | namespace hana = boost::hana; 8 | 9 | template struct x {}; 10 | 11 | int main() { 12 | <% env[:k].times do |k| %> 13 | constexpr auto <%= "xs#{k}" %> = hana::make_tuple( 14 | hana::make_tuple( 15 | <%= ((k*n+1)..(k*n+n)).map{ |i| "x<#{i}>{}" }.join(', ') %> 16 | ), 17 | hana::make_tuple( 18 | <%= ((k*n+1)..(k*n+n)).map{ |i| "x<-#{i}>{}" }.join(', ') %> 19 | ) 20 | ); 21 | 22 | #if defined(METABENCH) 23 | constexpr auto <%= "result#{k}" %> = hana::cartesian_product(<%= "xs#{k}" %>); 24 | #endif 25 | <% end %> 26 | } 27 | -------------------------------------------------------------------------------- /benchmark/hetero/count_if/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero count_if fusion list fusion.list.cpp.erb 3 "(0..50).step(10)") 7 | add_dataset(datasets hetero count_if fusion vector fusion.vector.cpp.erb 3 "(0..50).step(10)") 8 | add_dataset(datasets hetero count_if hana tuple hana.tuple.cpp.erb 5 "(0..50).step(10).to_a + (100..300).step(50).to_a") 9 | 10 | add_chart(hetero count_if DATASETS ${datasets}) 11 | -------------------------------------------------------------------------------- /benchmark/hetero/count_if/fusion.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | namespace fusion = boost::fusion; 10 | 11 | struct is_even { 12 | template 13 | constexpr bool operator()(N const&) const { 14 | return N::value % 2 == 0; 15 | } 16 | }; 17 | 18 | int main() { 19 | <% env[:k].times do |k| %> 20 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_list( 21 | <%= ((k*n+1)..(k*n+n)).map { |i| "std::integral_constant{}" }.join(', ') %> 22 | ); 23 | 24 | #if defined(METABENCH) 25 | /*constexpr*/ auto <%= "result#{k}" %> = fusion::count_if(<%= "xs#{k}" %>, is_even{}); 26 | #endif 27 | <% end %> 28 | } 29 | -------------------------------------------------------------------------------- /benchmark/hetero/count_if/fusion.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | namespace fusion = boost::fusion; 10 | 11 | struct is_even { 12 | template 13 | constexpr bool operator()(N const&) const { 14 | return N::value % 2 == 0; 15 | } 16 | }; 17 | 18 | int main() { 19 | <% env[:k].times do |k| %> 20 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_vector( 21 | <%= ((k*n+1)..(k*n+n)).map { |i| "std::integral_constant{}" }.join(', ') %> 22 | ); 23 | 24 | #if defined(METABENCH) 25 | /*constexpr*/ auto <%= "result#{k}" %> = fusion::count_if(<%= "xs#{k}" %>, is_even{}); 26 | #endif 27 | <% end %> 28 | } 29 | -------------------------------------------------------------------------------- /benchmark/hetero/count_if/hana.tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | namespace hana = boost::hana; 10 | 11 | struct is_even { 12 | template 13 | constexpr bool operator()(N const&) const { 14 | return N::value % 2 == 0; 15 | } 16 | }; 17 | 18 | int main() { 19 | <% env[:k].times do |k| %> 20 | constexpr auto <%= "xs#{k}" %> = hana::make_tuple( 21 | <%= ((k*n+1)..(k*n+n)).map { |i| "std::integral_constant{}" }.join(', ') %> 22 | ); 23 | 24 | #if defined(METABENCH) 25 | constexpr auto <%= "result#{k}" %> = hana::count_if(<%= "xs#{k}" %>, is_even{}); 26 | #endif 27 | <% end %> 28 | } 29 | -------------------------------------------------------------------------------- /benchmark/hetero/difference/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero difference hana set hana.set.cpp.erb 1 "(0..50).step(10)") 7 | 8 | add_chart(hetero difference DATASETS ${datasets}) 9 | -------------------------------------------------------------------------------- /benchmark/hetero/difference/hana.set.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | namespace hana = boost::hana; 9 | 10 | int main() { 11 | <% env[:k].times do |k| %> 12 | constexpr auto <%= "xs#{k}" %> = hana::make_set( 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "hana::int_c<#{i}>" }.join(', ') %> 14 | ); 15 | 16 | constexpr auto <%= "ys#{k}" %> = hana::make_set( 17 | <%= ((k*n+1)..(k*n+n)).step(2).map { |i| "hana::int_c<#{i}>" }.join(', ') %> 18 | ); 19 | 20 | #if defined(METABENCH) 21 | constexpr auto <%= "result#{k}" %> = hana::difference(<%= "xs#{k}" %>, <%= "ys#{k}" %>); 22 | #endif 23 | <% end %> 24 | } 25 | -------------------------------------------------------------------------------- /benchmark/hetero/filter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero filter fusion list fusion.list.cpp.erb 2 "(0..50).step(10)") 7 | add_dataset(datasets hetero filter fusion vector fusion.vector.cpp.erb 2 "(0..50).step(10)") 8 | add_dataset(datasets hetero filter hana tuple hana.tuple.cpp.erb 2 "(0..50).step(10).to_a + (100..300).step(50).to_a") 9 | add_dataset(datasets hetero filter tmp pack tmp.pack.cpp.erb 2 "(0..50).step(10).to_a + (100..300).step(50).to_a") 10 | 11 | add_chart(hetero filter DATASETS ${datasets}) 12 | -------------------------------------------------------------------------------- /benchmark/hetero/filter/fusion.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | namespace fusion = boost::fusion; 11 | 12 | struct is_even { 13 | template 14 | using apply = std::integral_constant; 15 | }; 16 | 17 | int main() { 18 | <% env[:k].times do |k| %> 19 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_list( 20 | <%= ((k*n+1)..(k*n+n)).map { |i| "std::integral_constant{}" }.join(', ') %> 21 | ); 22 | 23 | #if defined(METABENCH) 24 | /*constexpr*/ auto <%= "result#{k}" %> = fusion::as_list(fusion::filter_if(<%= "xs#{k}" %>)); 25 | #endif 26 | <% end %> 27 | } 28 | -------------------------------------------------------------------------------- /benchmark/hetero/filter/fusion.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | namespace fusion = boost::fusion; 11 | 12 | struct is_even { 13 | template 14 | using apply = std::integral_constant; 15 | }; 16 | 17 | int main() { 18 | <% env[:k].times do |k| %> 19 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_vector( 20 | <%= ((k*n+1)..(k*n+n)).map { |i| "std::integral_constant{}" }.join(', ') %> 21 | ); 22 | 23 | #if defined(METABENCH) 24 | /*constexpr*/ auto <%= "result#{k}" %> = fusion::as_vector(fusion::filter_if(<%= "xs#{k}" %>)); 25 | #endif 26 | <% end %> 27 | } 28 | -------------------------------------------------------------------------------- /benchmark/hetero/filter/hana.tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | namespace hana = boost::hana; 10 | 11 | struct is_even { 12 | template 13 | constexpr std::integral_constant 14 | operator()(N const&) const; 15 | }; 16 | 17 | int main() { 18 | <% env[:k].times do |k| %> 19 | constexpr auto <%= "xs#{k}" %> = hana::make_tuple( 20 | <%= ((k*n+1)..(k*n+n)).map { |i| "std::integral_constant{}" }.join(', ') %> 21 | ); 22 | 23 | #if defined(METABENCH) 24 | constexpr auto <%= "result#{k}" %> = hana::filter(<%= "xs#{k}" %>, is_even{}); 25 | #endif 26 | <% end %> 27 | } 28 | -------------------------------------------------------------------------------- /benchmark/hetero/filter/tmp.pack.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2018 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | namespace tmp = boost::tmp; 8 | 9 | template 10 | using is_even = tmp::bool_<(T::value % 2 == 0)>; 11 | 12 | int main() { 13 | <% env[:k].times do |k| %> 14 | constexpr auto <%= "xs#{k}" %> = tmp::val_pack_( 15 | <%= ((k*n+1)..(k*n+n)).map { |i| "tmp::int_<#{i}>{}" }.join(', ') %> 16 | ); 17 | 18 | #if defined(METABENCH) 19 | constexpr auto <%= "result#{k}" %> = <%= "xs#{k}" %> >>= tmp::filter_>{}; 20 | #endif 21 | <% end %> 22 | } 23 | -------------------------------------------------------------------------------- /benchmark/hetero/find_if/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero find_if fusion list fusion.list.cpp.erb 3 "(0..50).step(10)") 7 | add_dataset(datasets hetero find_if fusion vector fusion.vector.cpp.erb 3 "(0..50).step(10).to_a + (100..100).step(50).to_a") 8 | add_dataset(datasets hetero find_if hana map hana.map.cpp.erb 3 "(0..50).step(10).to_a + (100..150).step(50).to_a") 9 | add_dataset(datasets hetero find_if hana set hana.set.cpp.erb 3 "(0..50).step(10).to_a + (100..300).step(50).to_a") 10 | add_dataset(datasets hetero find_if hana tuple hana.tuple.cpp.erb 3 "(0..50).step(10).to_a + (100..300).step(50).to_a") 11 | add_dataset(datasets hetero find_if tmp pack tmp.pack.cpp.erb 3 "(0..50).step(10).to_a + (100..300).step(50).to_a") 12 | 13 | add_chart(hetero find_if DATASETS ${datasets}) 14 | -------------------------------------------------------------------------------- /benchmark/hetero/find_if/fusion.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | namespace fusion = boost::fusion; 10 | 11 | template 12 | struct equals_to { 13 | template 14 | struct apply 15 | : std::integral_constant 16 | {}; 17 | }; 18 | 19 | int main() { 20 | <% env[:k].times do |k| %> 21 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 22 | 23 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_list( 24 | <%= ints.map { |i| "std::integral_constant{}" }.join(', ') %> 25 | ); 26 | 27 | #if defined(METABENCH) 28 | /*constexpr*/ auto <%= "result#{k}" %> = fusion::find_if>>(<%= "xs#{k}" %>); 29 | #endif 30 | <% end %> 31 | } 32 | -------------------------------------------------------------------------------- /benchmark/hetero/find_if/fusion.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | namespace fusion = boost::fusion; 10 | 11 | template 12 | struct equals_to { 13 | template 14 | struct apply 15 | : std::integral_constant 16 | {}; 17 | }; 18 | 19 | int main() { 20 | <% env[:k].times do |k| %> 21 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 22 | 23 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_vector( 24 | <%= ints.map { |i| "std::integral_constant{}" }.join(', ') %> 25 | ); 26 | 27 | #if defined(METABENCH) 28 | /*constexpr*/ auto <%= "result#{k}" %> = fusion::find_if>>(<%= "xs#{k}" %>); 29 | #endif 30 | <% end %> 31 | } 32 | -------------------------------------------------------------------------------- /benchmark/hetero/find_if/hana.map.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Jason Rice 2015 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | namespace hana = boost::hana; 10 | 11 | template 12 | struct equals_to { 13 | template 14 | constexpr std::integral_constant 15 | operator()(Y const&) const; 16 | }; 17 | 18 | struct undefined {}; 19 | 20 | int main() { 21 | <% env[:k].times do |k| %> 22 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 23 | 24 | constexpr auto <%= "xs#{k}" %> = hana::make_map( 25 | <%= ints.map { |i| 26 | "hana::make_pair(std::integral_constant{}, undefined{})" 27 | }.join(', ') %> 28 | ); 29 | 30 | #if defined(METABENCH) 31 | constexpr auto <%= "result#{k}" %> = hana::find_if(<%= "xs#{k}" %>, equals_to<<%= ints.last || 0 %>>{}); 32 | #endif 33 | <% end %> 34 | } 35 | -------------------------------------------------------------------------------- /benchmark/hetero/find_if/hana.set.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | namespace hana = boost::hana; 10 | 11 | template 12 | struct equals_to { 13 | template 14 | constexpr std::integral_constant 15 | operator()(Y const&) const; 16 | }; 17 | 18 | int main() { 19 | <% env[:k].times do |k| %> 20 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 21 | 22 | constexpr auto <%= "xs#{k}" %> = hana::make_set( 23 | <%= ints.map { |i| "std::integral_constant{}" }.join(', ') %> 24 | ); 25 | 26 | #if defined(METABENCH) 27 | constexpr auto <%= "result#{k}" %> = hana::find_if(<%= "xs#{k}" %>, equals_to<<%= ints.last || 0 %>>{}); 28 | #endif 29 | <% end %> 30 | } 31 | -------------------------------------------------------------------------------- /benchmark/hetero/find_if/hana.tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | namespace hana = boost::hana; 10 | 11 | template 12 | struct equals_to { 13 | template 14 | constexpr std::integral_constant 15 | operator()(Y const&) const; 16 | }; 17 | 18 | int main() { 19 | <% env[:k].times do |k| %> 20 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 21 | 22 | constexpr auto <%= "xs#{k}" %> = hana::make_tuple( 23 | <%= ints.map { |i| "std::integral_constant{}" }.join(', ') %> 24 | ); 25 | 26 | #if defined(METABENCH) 27 | constexpr auto <%= "result#{k}" %> = hana::find_if(<%= "xs#{k}" %>, equals_to<<%= ints.last || 0 %>>{}); 28 | #endif 29 | <% end %> 30 | } 31 | -------------------------------------------------------------------------------- /benchmark/hetero/find_if/tmp.pack.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2018 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | namespace tmp = boost::tmp; 8 | 9 | template 10 | struct equals_to { 11 | template 12 | using f = tmp::bool_<(Y::value == X)>; 13 | }; 14 | 15 | int main() { 16 | <% env[:k].times do |k| %> 17 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 18 | 19 | constexpr auto <%= "xs#{k}" %> = tmp::val_pack_( 20 | <%= ints.map { |i| "tmp::int_<#{i}>{}" }.join(', ') %> 21 | ); 22 | 23 | #if defined(METABENCH) 24 | constexpr auto <%= "result#{k}" %> = <%= "xs#{k}" %> >>= tmp::find_if_>::template f>>{}; 25 | #endif 26 | <% end %> 27 | } 28 | -------------------------------------------------------------------------------- /benchmark/hetero/fold_left/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero fold_left fusion list fusion.list.cpp.erb 3 "(0..50).step(10)") 7 | add_dataset(datasets hetero fold_left fusion vector fusion.vector.cpp.erb 3 "(0..50).step(10)") 8 | add_dataset(datasets hetero fold_left hana basic_tuple hana.basic_tuple.cpp.erb 5 "(0..50).step(10).to_a + (100..300).step(50).to_a") 9 | add_dataset(datasets hetero fold_left hana tuple hana.tuple.cpp.erb 5 "(0..50).step(10).to_a + (100..300).step(50).to_a") 10 | 11 | add_chart(hetero fold_left DATASETS ${datasets}) 12 | -------------------------------------------------------------------------------- /benchmark/hetero/fold_left/fusion.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | namespace fusion = boost::fusion; 8 | 9 | struct f { 10 | template 11 | constexpr X operator()(State, X x) const { return x; } 12 | }; 13 | 14 | struct state {}; 15 | 16 | template struct x {}; 17 | 18 | int main() { 19 | <% env[:k].times do |k| %> 20 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_list( 21 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 22 | ); 23 | 24 | #if defined(METABENCH) 25 | /*constexpr*/ auto <%= "result#{k}" %> = fusion::fold(<%= "xs#{k}" %>, state{}, f{}); 26 | #endif 27 | <% end %> 28 | } 29 | -------------------------------------------------------------------------------- /benchmark/hetero/fold_left/fusion.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | namespace fusion = boost::fusion; 8 | 9 | struct f { 10 | template 11 | constexpr X operator()(State, X x) const { return x; } 12 | }; 13 | 14 | struct state {}; 15 | 16 | template struct x {}; 17 | 18 | int main() { 19 | <% env[:k].times do |k| %> 20 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_vector( 21 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 22 | ); 23 | 24 | #if defined(METABENCH) 25 | /*constexpr*/ auto <%= "result#{k}" %> = fusion::fold(<%= "xs#{k}" %>, state{}, f{}); 26 | #endif 27 | <% end %> 28 | } 29 | -------------------------------------------------------------------------------- /benchmark/hetero/fold_left/hana.basic_tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | namespace hana = boost::hana; 8 | 9 | struct f { 10 | template 11 | constexpr X operator()(State, X x) const { return x; } 12 | }; 13 | 14 | struct state {}; 15 | 16 | template struct x {}; 17 | 18 | int main() { 19 | <% env[:k].times do |k| %> 20 | constexpr auto <%= "xs#{k}" %> = hana::make_basic_tuple( 21 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 22 | ); 23 | 24 | #if defined(METABENCH) 25 | constexpr auto <%= "result#{k}" %> = hana::fold_left(<%= "xs#{k}" %>, state{}, f{}); 26 | #endif 27 | <% end %> 28 | } 29 | -------------------------------------------------------------------------------- /benchmark/hetero/fold_left/hana.tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | namespace hana = boost::hana; 8 | 9 | struct f { 10 | template 11 | constexpr X operator()(State, X x) const { return x; } 12 | }; 13 | 14 | struct state {}; 15 | 16 | template struct x {}; 17 | 18 | int main() { 19 | <% env[:k].times do |k| %> 20 | constexpr auto <%= "xs#{k}" %> = hana::make_tuple( 21 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 22 | ); 23 | 24 | #if defined(METABENCH) 25 | constexpr auto <%= "result#{k}" %> = hana::fold_left(<%= "xs#{k}" %>, state{}, f{}); 26 | #endif 27 | <% end %> 28 | } 29 | -------------------------------------------------------------------------------- /benchmark/hetero/fold_right/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero fold_right fusion vector fusion.vector.cpp.erb 3 "(0..50).step(10)") 7 | add_dataset(datasets hetero fold_right hana basic_tuple hana.basic_tuple.cpp.erb 5 "(0..50).step(10).to_a + (100..300).step(50).to_a") 8 | add_dataset(datasets hetero fold_right hana tuple hana.tuple.cpp.erb 5 "(0..50).step(10).to_a + (100..300).step(50).to_a") 9 | 10 | add_chart(hetero fold_right DATASETS ${datasets}) 11 | -------------------------------------------------------------------------------- /benchmark/hetero/fold_right/fusion.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | namespace fusion = boost::fusion; 8 | 9 | struct f { 10 | template 11 | constexpr X operator()(State, X x) const { return x; } 12 | }; 13 | 14 | struct state {}; 15 | 16 | template struct x {}; 17 | 18 | int main() { 19 | <% env[:k].times do |k| %> 20 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_vector( 21 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 22 | ); 23 | 24 | #if defined(METABENCH) 25 | /*constexpr*/ auto <%= "result#{k}" %> = fusion::reverse_fold(<%= "xs#{k}" %>, state{}, f{}); 26 | #endif 27 | <% end %> 28 | } 29 | -------------------------------------------------------------------------------- /benchmark/hetero/fold_right/hana.basic_tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | namespace hana = boost::hana; 8 | 9 | struct f { 10 | template 11 | constexpr X operator()(X x, State) const { return x; } 12 | }; 13 | 14 | struct state {}; 15 | 16 | template struct x {}; 17 | 18 | int main() { 19 | <% env[:k].times do |k| %> 20 | constexpr auto <%= "xs#{k}" %> = hana::make_basic_tuple( 21 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 22 | ); 23 | 24 | #if defined(METABENCH) 25 | constexpr auto <%= "result#{k}" %> = hana::fold_right(<%= "xs#{k}" %>, state{}, f{}); 26 | #endif 27 | <% end %> 28 | } 29 | -------------------------------------------------------------------------------- /benchmark/hetero/fold_right/hana.tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | namespace hana = boost::hana; 8 | 9 | struct f { 10 | template 11 | constexpr X operator()(X x, State) const { return x; } 12 | }; 13 | 14 | struct state {}; 15 | 16 | template struct x {}; 17 | 18 | int main() { 19 | <% env[:k].times do |k| %> 20 | constexpr auto <%= "xs#{k}" %> = hana::make_tuple( 21 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 22 | ); 23 | 24 | #if defined(METABENCH) 25 | constexpr auto <%= "result#{k}" %> = hana::fold_right(<%= "xs#{k}" %>, state{}, f{}); 26 | #endif 27 | <% end %> 28 | } 29 | -------------------------------------------------------------------------------- /benchmark/hetero/insert/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero insert hana map hana.map.cpp.erb 1 "(0..50).step(10).to_a + (100..300).step(50).to_a") 7 | add_dataset(datasets hetero insert hana set hana.set.cpp.erb 1 "(0..50).step(10).to_a + (100..300).step(50).to_a") 8 | 9 | add_chart(hetero insert DATASETS ${datasets}) 10 | -------------------------------------------------------------------------------- /benchmark/hetero/insert/hana.map.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | namespace hana = boost::hana; 10 | 11 | int main() { 12 | <% env[:k].times do |k| %> 13 | constexpr auto <%= "xs#{k}" %> = hana::make_map( 14 | <%= ((k*n+1)..(k*n+n)).map { |i| 15 | "hana::make_pair(hana::int_c<#{i}>, hana::int_c<#{i}>)" 16 | }.join(', ') %> 17 | ); 18 | constexpr auto <%= "next#{k}" %> = hana::int_c< <%= n + 1 %> >; 19 | constexpr auto <%= "pair#{k}" %> = hana::make_pair(<%= "next#{k}" %>, <%= "next#{k}" %>); 20 | 21 | #if defined(METABENCH) 22 | constexpr auto <%= "result#{k}" %> = hana::insert(<%= "xs#{k}" %>, <%= "pair#{k}" %>); 23 | #endif 24 | <% end %> 25 | } 26 | -------------------------------------------------------------------------------- /benchmark/hetero/insert/hana.set.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | namespace hana = boost::hana; 9 | 10 | int main() { 11 | <% env[:k].times do |k| %> 12 | constexpr auto <%= "xs#{k}" %> = hana::make_set( 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "hana::int_c<#{i}>" }.join(', ') %> 14 | ); 15 | constexpr auto <%= "next#{k}" %> = hana::int_c< <%= n + 1 %> >; 16 | 17 | #if defined(METABENCH) 18 | constexpr auto <%= "result#{k}" %> = hana::insert(<%= "xs#{k}" %>, <%= "next#{k}" %>); 19 | #endif 20 | <% end %> 21 | } 22 | -------------------------------------------------------------------------------- /benchmark/hetero/intersection/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero intersection hana set hana.set.cpp.erb 3 "(0..50).step(10)") 7 | 8 | add_chart(hetero intersection DATASETS ${datasets}) 9 | -------------------------------------------------------------------------------- /benchmark/hetero/intersection/hana.set.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | namespace hana = boost::hana; 9 | 10 | int main() { 11 | <% env[:k].times do |k| %> 12 | constexpr auto <%= "xs#{k}" %> = hana::make_set( 13 | <%= ((k*n+1)..(k*n+n/2)).map { |i| "hana::int_<#{i}>{}" }.join(', ') %> 14 | ); 15 | 16 | constexpr auto <%= "ys#{k}" %> = hana::make_set( 17 | <%= ((k*n+n/2)..(k*n+n)).map { |i| "hana::int_<#{i}>{}" }.join(', ') %> 18 | ); 19 | 20 | #if defined(METABENCH) 21 | constexpr auto <%= "result#{k}" %> = hana::intersection(<%= "xs#{k}" %>, <%= "ys#{k}" %>); 22 | #endif 23 | <% end %> 24 | } 25 | -------------------------------------------------------------------------------- /benchmark/hetero/is_disjoint/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero is_disjoint hana set hana.set.cpp.erb 1 "(0..50).step(10)") 7 | add_dataset(datasets hetero is_disjoint hana map hana.map.cpp.erb 1 "(0..50).step(10)") 8 | add_dataset(datasets hetero is_disjoint hana tuple hana.tuple.cpp.erb 1 "(0..50).step(10)") 9 | 10 | add_chart(hetero is_disjoint DATASETS ${datasets}) 11 | -------------------------------------------------------------------------------- /benchmark/hetero/is_disjoint/hana.map.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | namespace hana = boost::hana; 10 | 11 | int main() { 12 | <% env[:k].times do |k| %> 13 | constexpr auto <%= "xs#{k}" %> = hana::make_map( 14 | <%= ((k*n+1)..(k*n+n)).map { |i| 15 | "hana::make_pair(hana::int_<#{i*2}>{}, hana::int_<#{i*2}>{})" 16 | }.join(', ') %> 17 | ); 18 | constexpr auto <%= "ys#{k}" %> = hana::make_map( 19 | <%= ((k*n+1)..(k*n+n)).map { |i| 20 | "hana::make_pair(hana::int_<#{i*2+1}>{}, hana::int_<#{i*2+1}>{})" 21 | }.join(', ') %> 22 | ); 23 | 24 | #if defined(METABENCH) 25 | constexpr auto <%= "result#{k}" %> = hana::is_disjoint(<%= "xs#{k}" %>, <%= "ys#{k}" %>); 26 | #endif 27 | <% end %> 28 | } 29 | -------------------------------------------------------------------------------- /benchmark/hetero/is_disjoint/hana.set.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | namespace hana = boost::hana; 9 | 10 | int main() { 11 | <% env[:k].times do |k| %> 12 | constexpr auto <%= "xs#{k}" %> = hana::make_set( 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "hana::int_<#{i*2}>{}" }.join(', ') %> 14 | ); 15 | constexpr auto <%= "ys#{k}" %> = hana::make_set( 16 | <%= ((k*n+1)..(k*n+n)).map { |i| "hana::int_<#{i*2+1}>{}" }.join(', ') %> 17 | ); 18 | 19 | #if defined(METABENCH) 20 | constexpr auto <%= "result#{k}" %> = hana::is_disjoint(<%= "xs#{k}" %>, <%= "ys#{k}" %>); 21 | #endif 22 | <% end %> 23 | } 24 | -------------------------------------------------------------------------------- /benchmark/hetero/is_disjoint/hana.tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | namespace hana = boost::hana; 9 | 10 | int main() { 11 | <% env[:k].times do |k| %> 12 | constexpr auto <%= "xs#{k}" %> = hana::make_tuple( 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "hana::int_<#{i*2}>{}" }.join(', ') %> 14 | ); 15 | constexpr auto <%= "ys#{k}" %> = hana::make_tuple( 16 | <%= ((k*n+1)..(k*n+n)).map { |i| "hana::int_<#{i*2+1}>{}" }.join(', ') %> 17 | ); 18 | 19 | #if defined(METABENCH) 20 | constexpr auto <%= "result#{k}" %> = hana::is_disjoint(<%= "xs#{k}" %>, <%= "ys#{k}" %>); 21 | #endif 22 | <% end %> 23 | } 24 | -------------------------------------------------------------------------------- /benchmark/hetero/is_subset/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero is_subset hana map hana.map.cpp.erb 3 "(0..50).step(10).to_a") 7 | add_dataset(datasets hetero is_subset hana set hana.set.cpp.erb 3 "(0..50).step(10).to_a") 8 | add_dataset(datasets hetero is_subset hana tuple hana.tuple.cpp.erb 3 "(0..50).step(10).to_a") 9 | 10 | add_chart(hetero is_subset DATASETS ${datasets}) 11 | -------------------------------------------------------------------------------- /benchmark/hetero/is_subset/hana.map.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | namespace hana = boost::hana; 10 | 11 | int main() { 12 | <% env[:k].times do |k| %> 13 | constexpr auto <%= "xs#{k}" %> = hana::make_map( 14 | <%= ((k*n+1)..(k*n+n)).step(2).map { |i| 15 | "hana::make_pair(hana::int_<#{i}>{}, hana::int_<#{i}>{})" 16 | }.join(', ') %> 17 | ); 18 | constexpr auto <%= "ys#{k}" %> = hana::make_map( 19 | <%= ((k*n+1)..(k*n+n)).map { |i| 20 | "hana::make_pair(hana::int_<#{i}>{}, hana::int_<#{i}>{})" 21 | }.join(', ') %> 22 | ); 23 | 24 | #if defined(METABENCH) 25 | constexpr auto <%= "result#{k}" %> = hana::is_subset(<%= "xs#{k}" %>, <%= "ys#{k}" %>); 26 | #endif 27 | <% end %> 28 | } 29 | -------------------------------------------------------------------------------- /benchmark/hetero/is_subset/hana.set.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | namespace hana = boost::hana; 9 | 10 | int main() { 11 | <% env[:k].times do |k| %> 12 | constexpr auto <%= "xs#{k}" %> = hana::make_set( 13 | <%= ((k*n+1)..(k*n+n)).step(2).map { |i| "hana::int_<#{i}>{}" }.join(', ') %> 14 | ); 15 | constexpr auto <%= "ys#{k}" %> = hana::make_set( 16 | <%= ((k*n+1)..(k*n+n)).map { |i| "hana::int_<#{i}>{}" }.join(', ') %> 17 | ); 18 | 19 | #if defined(METABENCH) 20 | constexpr auto <%= "result#{k}" %> = hana::is_subset(<%= "xs#{k}" %>, <%= "ys#{k}" %>); 21 | #endif 22 | <% end %> 23 | } 24 | -------------------------------------------------------------------------------- /benchmark/hetero/is_subset/hana.tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | namespace hana = boost::hana; 9 | 10 | int main() { 11 | <% env[:k].times do |k| %> 12 | constexpr auto <%= "xs#{k}" %> = hana::make_tuple( 13 | <%= ((k*n+1)..(k*n+n)).step(2).map { |i| "hana::int_<#{i}>{}" }.join(', ') %> 14 | ); 15 | constexpr auto <%= "ys#{k}" %> = hana::make_tuple( 16 | <%= ((k*n+1)..(k*n+n)).map { |i| "hana::int_<#{i}>{}" }.join(', ') %> 17 | ); 18 | 19 | #if defined(METABENCH) 20 | constexpr auto <%= "result#{k}" %> = hana::is_subset(<%= "xs#{k}" %>, <%= "ys#{k}" %>); 21 | #endif 22 | <% end %> 23 | } 24 | -------------------------------------------------------------------------------- /benchmark/hetero/lexicographical_compare/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero lexicographical_compare hana tuple hana.tuple.cpp.erb 1 "(0..50).step(10).to_a + (100..100).step(50).to_a") 7 | 8 | add_chart(hetero lexicographical_compare DATASETS ${datasets}) 9 | -------------------------------------------------------------------------------- /benchmark/hetero/lexicographical_compare/hana.tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | namespace hana = boost::hana; 8 | 9 | int main() { 10 | <% env[:k].times do |k| %> 11 | constexpr auto <%= "xs#{k}" %> = hana::make_tuple( 12 | <%= ((k*n+1)..(k*n+n)).map { |i| i.to_s }.join(', ') %> 13 | ); 14 | constexpr auto <%= "ys#{k}" %> = hana::make_tuple( 15 | <%= ((k*n+1)..(k*n+n)).map { |i| (i == (k*n+n) ? i + 1 : i).to_s }.join(', ') %> 16 | ); 17 | 18 | #if defined(METABENCH) 19 | constexpr auto <%= "result#{k}" %> = hana::lexicographical_compare(<%= "xs#{k}" %>, <%= "ys#{k}" %>); 20 | #endif 21 | <% end %> 22 | } 23 | -------------------------------------------------------------------------------- /benchmark/hetero/make/fusion.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace fusion = boost::fusion; 7 | 8 | template struct x {}; 9 | 10 | int main() { 11 | <% env[:k].times do |k| %> 12 | #if defined(METABENCH) 13 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_list( 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>()" }.join(', ') %> 15 | ); 16 | #endif 17 | <% end %> 18 | } 19 | -------------------------------------------------------------------------------- /benchmark/hetero/make/fusion.map.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace fusion = boost::fusion; 7 | 8 | template struct x {}; 9 | 10 | struct undefined {}; 11 | 12 | int main() { 13 | <% env[:k].times do |k| %> 14 | #if defined(METABENCH) 15 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_map<<%= 16 | ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') 17 | %>>(<%= 18 | ((k*n+1)..(k*n+n)).map { |i| "undefined{}" }.join(', ') 19 | %>); 20 | #endif 21 | <% end %> 22 | } 23 | -------------------------------------------------------------------------------- /benchmark/hetero/make/fusion.set.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace fusion = boost::fusion; 7 | 8 | template struct x {}; 9 | 10 | int main() { 11 | <% env[:k].times do |k| %> 12 | #if defined(METABENCH) 13 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_set(<%= 14 | ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') 15 | %>); 16 | #endif 17 | <% end %> 18 | } 19 | -------------------------------------------------------------------------------- /benchmark/hetero/make/fusion.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace fusion = boost::fusion; 7 | 8 | template struct x {}; 9 | 10 | int main() { 11 | <% env[:k].times do |k| %> 12 | #if defined(METABENCH) 13 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_vector( 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>()" }.join(', ') %> 15 | ); 16 | #endif 17 | <% end %> 18 | } 19 | -------------------------------------------------------------------------------- /benchmark/hetero/make/hana.basic_tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace hana = boost::hana; 7 | 8 | template struct x {}; 9 | 10 | int main() { 11 | <% env[:k].times do |k| %> 12 | #if defined(METABENCH) 13 | constexpr auto <%= "xs#{k}" %> = hana::make_basic_tuple( 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 15 | ); 16 | #endif 17 | <% end %> 18 | } 19 | -------------------------------------------------------------------------------- /benchmark/hetero/make/hana.tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace hana = boost::hana; 7 | 8 | template struct x {}; 9 | 10 | int main() { 11 | <% env[:k].times do |k| %> 12 | #if defined(METABENCH) 13 | constexpr auto <%= "xs#{k}" %> = hana::make_tuple( 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 15 | ); 16 | #endif 17 | <% end %> 18 | } 19 | -------------------------------------------------------------------------------- /benchmark/hetero/make/std.array.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template struct x {}; 8 | 9 | int main() { 10 | <% env[:k].times do |k| %> 11 | #if defined(METABENCH) 12 | constexpr std::array> <%= "xs#{k}" %> = {{ 13 | <%= ((k*n+1)..(k*n+n)).to_a.join(', ') %> 14 | }}; 15 | #endif 16 | <% end %> 17 | } 18 | -------------------------------------------------------------------------------- /benchmark/hetero/make/std.tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template struct x {}; 8 | 9 | int main() { 10 | <% env[:k].times do |k| %> 11 | #if defined(METABENCH) 12 | constexpr auto <%= "xs#{k}" %> = std::make_tuple( 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 14 | ); 15 | #endif 16 | <% end %> 17 | } 18 | -------------------------------------------------------------------------------- /benchmark/hetero/make/tmp.pack.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2018 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | namespace tmp = boost::tmp; 8 | template struct x {}; 9 | 10 | int main() { 11 | <% env[:k].times do |k| %> 12 | #if defined(METABENCH) 13 | constexpr auto <%= "xs#{k}" %> = tmp::val_pack_( 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 15 | ); 16 | #endif 17 | <% end %> 18 | } 19 | -------------------------------------------------------------------------------- /benchmark/hetero/partition/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero partition hana tuple hana.tuple.cpp.erb 1 "(0..50).step(10).to_a + (100..300).step(50).to_a") 7 | 8 | add_chart(hetero partition DATASETS ${datasets}) 9 | -------------------------------------------------------------------------------- /benchmark/hetero/partition/hana.tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | namespace hana = boost::hana; 11 | 12 | struct is_even { 13 | template 14 | constexpr auto operator()(N n) const { 15 | return n % hana::int_<2>{} == hana::int_<0>{}; 16 | } 17 | }; 18 | 19 | int main() { 20 | <% env[:k].times do |k| %> 21 | constexpr auto <%= "xs#{k}" %> = hana::make_tuple( 22 | <%= ((k*n+1)..(k*n+n)).map { |i| "hana::int_<#{i}>{}" }.join(', ') %> 23 | ); 24 | 25 | #if defined(METABENCH) 26 | constexpr auto <%= "result#{k}" %> = boost::hana::partition(<%= "xs#{k}" %>, is_even{}); 27 | #endif 28 | <% end %> 29 | } 30 | -------------------------------------------------------------------------------- /benchmark/hetero/sort/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero sort hana tuple hana.tuple.cpp.erb 1 "(0..50).step(10).to_a + (100..100).step(50).to_a") 7 | 8 | add_chart(hetero sort DATASETS ${datasets}) 9 | -------------------------------------------------------------------------------- /benchmark/hetero/sort/hana.tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | namespace hana = boost::hana; 9 | 10 | int main() { 11 | <% env[:k].times do |k| %> 12 | constexpr auto <%= "xs#{k}" %> = hana::make_tuple(<%= 13 | ints = ((k*n+1)..(k*n+n)).map { |i| "hana::int_<#{i}>{}" } 14 | rng = Random.new(k) 15 | ints.shuffle(random: rng).join(', ') 16 | %>); 17 | 18 | #if defined(METABENCH) 19 | constexpr auto <%= "result#{k}" %> = hana::sort(<%= "xs#{k}" %>); 20 | #endif 21 | <% end %> 22 | } 23 | -------------------------------------------------------------------------------- /benchmark/hetero/symmetric_difference/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero symmetric_difference hana set hana.set.cpp.erb 1 "(0..50).step(10).to_a") 7 | 8 | add_chart(hetero symmetric_difference DATASETS ${datasets}) 9 | -------------------------------------------------------------------------------- /benchmark/hetero/symmetric_difference/hana.set.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | namespace hana = boost::hana; 9 | 10 | int main() { 11 | <% env[:k].times do |k| %> 12 | constexpr auto <%= "xs#{k}" %> = hana::make_set( 13 | <%= ((k*n+1)..(k*n+n/2)).map { |i| "hana::int_<#{i}>{}" }.join(', ') %> 14 | ); 15 | 16 | constexpr auto <%= "ys#{k}" %> = hana::make_set( 17 | <%= ((k*n+n/2)..(k*n+n)).map { |i| "hana::int_<#{i}>{}" }.join(', ') %> 18 | ); 19 | 20 | #if defined(METABENCH) 21 | constexpr auto <%= "result#{k}" %> = hana::symmetric_difference(<%= "xs#{k}" %>, <%= "ys#{k}" %>); 22 | #endif 23 | <% end %> 24 | } 25 | -------------------------------------------------------------------------------- /benchmark/hetero/transform/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero transform fusion list fusion.list.cpp.erb 2 "(0..50).step(10)") 7 | add_dataset(datasets hetero transform fusion vector fusion.vector.cpp.erb 2 "(0..50).step(10)") 8 | add_dataset(datasets hetero transform hana basic_tuple hana.basic_tuple.cpp.erb 5 "(0..50).step(10).to_a + (100..300).step(50).to_a") 9 | add_dataset(datasets hetero transform hana tuple hana.tuple.cpp.erb 5 "(0..50).step(10).to_a + (100..300).step(50).to_a") 10 | 11 | add_chart(hetero transform DATASETS ${datasets}) 12 | -------------------------------------------------------------------------------- /benchmark/hetero/transform/fusion.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | namespace fusion = boost::fusion; 9 | 10 | struct f { 11 | template struct result; 12 | template struct result { typedef X type; }; 13 | 14 | template 15 | constexpr X operator()(X x) const { return x; } 16 | }; 17 | 18 | template struct x {}; 19 | 20 | int main() { 21 | <% env[:k].times do |k| %> 22 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_list( 23 | <%= ((k*n+1)..(k*n+n)).map { |n| "x<#{n}>()" }.join(', ') %> 24 | ); 25 | 26 | #if defined(METABENCH) 27 | /*constexpr*/ auto <%= "result#{k}" %> = fusion::as_list(fusion::transform(<%= "xs#{k}" %>, f{})); 28 | #endif 29 | <% end %> 30 | } 31 | -------------------------------------------------------------------------------- /benchmark/hetero/transform/fusion.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | namespace fusion = boost::fusion; 9 | 10 | struct f { 11 | template struct result; 12 | template struct result { typedef X type; }; 13 | 14 | template 15 | constexpr X operator()(X x) const { return x; } 16 | }; 17 | 18 | template struct x {}; 19 | 20 | int main() { 21 | <% env[:k].times do |k| %> 22 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_vector( 23 | <%= ((k*n+1)..(k*n+n)).map { |n| "x<#{n}>()" }.join(', ') %> 24 | ); 25 | 26 | #if defined(METABENCH) 27 | /*constexpr*/ auto <%= "result#{k}" %> = fusion::as_vector(fusion::transform(<%= "xs#{k}" %>, f{})); 28 | #endif 29 | <% end %> 30 | } 31 | -------------------------------------------------------------------------------- /benchmark/hetero/transform/hana.basic_tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | namespace hana = boost::hana; 8 | 9 | struct f { 10 | template 11 | constexpr X operator()(X x) const { return x; } 12 | }; 13 | 14 | template struct x {}; 15 | 16 | int main() { 17 | <% env[:k].times do |k| %> 18 | constexpr auto <%= "xs#{k}" %> = hana::make_basic_tuple( 19 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 20 | ); 21 | 22 | #if defined(METABENCH) 23 | constexpr auto <%= "result#{k}" %> = hana::transform(<%= "xs#{k}" %>, f{}); 24 | #endif 25 | <% end %> 26 | } 27 | -------------------------------------------------------------------------------- /benchmark/hetero/transform/hana.tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | namespace hana = boost::hana; 8 | 9 | struct f { 10 | template 11 | constexpr X operator()(X x) const { return x; } 12 | }; 13 | 14 | template struct x {}; 15 | 16 | int main() { 17 | <% env[:k].times do |k| %> 18 | constexpr auto <%= "xs#{k}" %> = hana::make_tuple( 19 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 20 | ); 21 | 22 | #if defined(METABENCH) 23 | constexpr auto <%= "result#{k}" %> = hana::transform(<%= "xs#{k}" %>, f{}); 24 | #endif 25 | <% end %> 26 | } 27 | -------------------------------------------------------------------------------- /benchmark/hetero/union/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero union hana set hana.set.cpp.erb 2 "(0..50).step(10).to_a") 7 | 8 | add_chart(hetero union DATASETS ${datasets}) 9 | -------------------------------------------------------------------------------- /benchmark/hetero/union/hana.set.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | namespace hana = boost::hana; 9 | 10 | int main() { 11 | <% env[:k].times do |k| %> 12 | constexpr auto <%= "xs#{k}" %> = hana::make_set( 13 | <%= ((k*n+1)..(k*n+n/2)).map { |i| "hana::int_<#{i}>{}" }.join(', ') %> 14 | ); 15 | 16 | constexpr auto <%= "ys#{k}" %> = hana::make_set( 17 | <%= ((k*n+n/2)..(k*n+n)).map { |i| "hana::int_<#{i}>{}" }.join(', ') %> 18 | ); 19 | 20 | #if defined(METABENCH) 21 | constexpr auto <%= "result#{k}" %> = hana::union_(<%= "xs#{k}" %>, <%= "ys#{k}" %>); 22 | #endif 23 | <% end %> 24 | } 25 | -------------------------------------------------------------------------------- /benchmark/hetero/unpack/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets hetero unpack fusion list fusion.list.cpp.erb 4 "(0..15).step(5)") 7 | add_dataset(datasets hetero unpack fusion vector fusion.vector.cpp.erb 4 "(0..15).step(5)") 8 | add_dataset(datasets hetero unpack hana basic_tuple hana.basic_tuple.cpp.erb 4 "(0..50).step(10).to_a + (100..300).step(50).to_a") 9 | add_dataset(datasets hetero unpack hana set hana.set.cpp.erb 4 "(0..50).step(10).to_a + (100..300).step(50).to_a") 10 | add_dataset(datasets hetero unpack hana tuple hana.tuple.cpp.erb 4 "(0..50).step(10).to_a + (100..300).step(50).to_a") 11 | 12 | add_chart(hetero unpack DATASETS ${datasets}) 13 | -------------------------------------------------------------------------------- /benchmark/hetero/unpack/fusion.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 6 %> 6 | #define BOOST_FUSION_INVOKE_MAX_ARITY <%= n %> 7 | <% end %> 8 | 9 | #include 10 | #include 11 | namespace fusion = boost::fusion; 12 | 13 | struct f { 14 | template 15 | constexpr void operator()(T const& ...) const {} 16 | }; 17 | 18 | template struct x {}; 19 | 20 | int main() { 21 | <% env[:k].times do |k| %> 22 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_list( 23 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 24 | ); 25 | 26 | #if defined(METABENCH) 27 | fusion::invoke(f{}, <%= "xs#{k}" %>); 28 | #endif 29 | <% end %> 30 | } 31 | -------------------------------------------------------------------------------- /benchmark/hetero/unpack/fusion.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 6 %> 6 | #define BOOST_FUSION_INVOKE_MAX_ARITY <%= n %> 7 | <% end %> 8 | 9 | #include 10 | #include 11 | namespace fusion = boost::fusion; 12 | 13 | struct f { 14 | template 15 | constexpr void operator()(T const& ...) const {} 16 | }; 17 | 18 | template struct x {}; 19 | 20 | int main() { 21 | <% env[:k].times do |k| %> 22 | /*constexpr*/ auto <%= "xs#{k}" %> = fusion::make_vector( 23 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 24 | ); 25 | 26 | #if defined(METABENCH) 27 | fusion::invoke(f{}, <%= "xs#{k}" %>); 28 | #endif 29 | <% end %> 30 | } 31 | -------------------------------------------------------------------------------- /benchmark/hetero/unpack/hana.basic_tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | namespace hana = boost::hana; 8 | 9 | struct f { 10 | template 11 | constexpr void operator()(T const& ...) const {} 12 | }; 13 | 14 | template struct x {}; 15 | 16 | int main() { 17 | <% env[:k].times do |k| %> 18 | constexpr auto <%= "xs#{k}" %> = hana::make_basic_tuple( 19 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 20 | ); 21 | 22 | #if defined(METABENCH) 23 | hana::unpack(<%= "xs#{k}" %>, f{}); 24 | #endif 25 | <% end %> 26 | } 27 | -------------------------------------------------------------------------------- /benchmark/hetero/unpack/hana.set.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | // Disable concept checks, otherwise x<> would need to be Comparable. 6 | // We only define the macro if it was not defined on the command line. 7 | #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS 8 | # define BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS 9 | #endif 10 | 11 | #include 12 | #include 13 | namespace hana = boost::hana; 14 | 15 | struct f { 16 | template 17 | constexpr void operator()(T const& ...) const {} 18 | }; 19 | 20 | template struct x {}; 21 | 22 | int main() { 23 | <% env[:k].times do |k| %> 24 | constexpr auto <%= "xs#{k}" %> = hana::make_set( 25 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 26 | ); 27 | 28 | #if defined(METABENCH) 29 | hana::unpack(<%= "xs#{k}" %>, f{}); 30 | #endif 31 | <% end %> 32 | } 33 | -------------------------------------------------------------------------------- /benchmark/hetero/unpack/hana.tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | namespace hana = boost::hana; 8 | 9 | struct f { 10 | template 11 | constexpr void operator()(T const& ...) const {} 12 | }; 13 | 14 | template struct x {}; 15 | 16 | int main() { 17 | <% env[:k].times do |k| %> 18 | constexpr auto <%= "xs#{k}" %> = hana::make_tuple( 19 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>{}" }.join(', ') %> 20 | ); 21 | 22 | #if defined(METABENCH) 23 | hana::unpack(<%= "xs#{k}" %>, f{}); 24 | #endif 25 | <% end %> 26 | } 27 | -------------------------------------------------------------------------------- /benchmark/type/all/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Bruno Dutra 2016 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets type all brigand list brigand.list.cpp.erb 15 "(0..50).step(10).to_a + (100..500).step(50).to_a") 7 | add_dataset(datasets type all kvasir list kvasir.list.cpp.erb 15 "(0..50).step(10).to_a + (100..500).step(50).to_a") 8 | add_dataset(datasets type all tmp list tmp.list.cpp.erb 15 "(0..50).step(10).to_a + (100..500).step(50).to_a") 9 | add_dataset(datasets type all meta list meta.list.cpp.erb 15 "(0..50).step(10).to_a + (100..500).step(50).to_a") 10 | add_dataset(datasets type all metal list metal.list.cpp.erb 15 "(0..50).step(10).to_a + (100..500).step(50).to_a") 11 | add_dataset(datasets type all mp11 list mp11.list.cpp.erb 15 "(0..50).step(10).to_a + (100..500).step(50).to_a") 12 | 13 | add_chart(type all DATASETS ${datasets}) 14 | -------------------------------------------------------------------------------- /benchmark/type/all/brigand.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #define BRIGAND_NO_BOOST_SUPPORT 6 | #include 7 | 8 | template 9 | using differs_from = brigand::bool_; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 14 | 15 | using <%= "xs#{k}" %> = brigand::list<<%= ints.map { |i| "brigand::int32_t<#{i}>" }.join(', ') %>>; 16 | 17 | #if defined(METABENCH) 18 | using <%= "result#{k}" %> = brigand::all<<%= "xs#{k}" %>, brigand::bind>, brigand::_1>>; 19 | #endif 20 | 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/all/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | template 9 | struct differs_from { 10 | template 11 | using f = mpl::bool_; 12 | }; 13 | 14 | <% env[:k].times do |k| %> 15 | 16 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 17 | 18 | using <%= "xs#{k}" %> = mpl::list<<%= ints.map { |i| "mpl::int_<#{i}>" }.join(', ') %>>; 19 | 20 | #if defined(METABENCH) 21 | using <%= "result#{k}" %> = mpl::call>>>,<%= "xs#{k}" %>>; 22 | #endif 23 | 24 | <% end %> 25 | 26 | int main() {} 27 | -------------------------------------------------------------------------------- /benchmark/type/all/meta.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template 8 | using differs_from = meta::bind_front>, meta::int_>; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 13 | 14 | using <%= "xs#{k}" %> = meta::list<<%= ints.map { |i| "meta::int_<#{i}>" }.join(', ') %>>; 15 | 16 | #if defined(METABENCH) 17 | using <%= "result#{k}" %> = meta::all_of<<%= "xs#{k}" %>, differs_from<<%= ints.last || 0 %>>>; 18 | #endif 19 | 20 | <% end %> 21 | 22 | int main() {} 23 | -------------------------------------------------------------------------------- /benchmark/type/all/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template 8 | struct differs_from { 9 | template 10 | using apply = metal::number; 11 | }; 12 | 13 | <% env[:k].times do |k| %> 14 | 15 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 16 | 17 | using <%= "xs#{k}" %> = metal::list<<%= ints.map { |i| "metal::number<#{i}>" }.join(', ') %>>; 18 | 19 | #if defined(METABENCH) 20 | using <%= "result#{k}" %> = metal::all_of<<%= "xs#{k}" %>, metal::lambda>::apply>>; 21 | #endif 22 | 23 | <% end %> 24 | 25 | int main() {} 26 | -------------------------------------------------------------------------------- /benchmark/type/all/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template 9 | struct differs_from { 10 | template 11 | using apply = mp_bool; 12 | }; 13 | 14 | <% env[:k].times do |k| %> 15 | 16 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 17 | 18 | using <%= "xs#{k}" %> = mp_list<<%= ints.map { |i| "std::integral_constant" }.join(', ') %>>; 19 | 20 | #if defined(METABENCH) 21 | using <%= "result#{k}" %> = mp_all_of<<%= "xs#{k}" %>, differs_from<<%= ints.last || 0 %>>::apply>; 22 | #endif 23 | 24 | <% end %> 25 | 26 | int main() {} 27 | -------------------------------------------------------------------------------- /benchmark/type/all/tmp.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace tmp = boost::tmp; 7 | 8 | template 9 | struct differs_from { 10 | template 11 | using f = tmp::bool_; 12 | }; 13 | 14 | <% env[:k].times do |k| %> 15 | 16 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 17 | 18 | using <%= "xs#{k}" %> = tmp::list_<<%= ints.map { |i| "tmp::int_<#{i}>" }.join(', ') %>>; 19 | 20 | #if defined(METABENCH) 21 | using <%= "result#{k}" %> = tmp::call_>::template f>>>,<%= "xs#{k}" %>>; 22 | #endif 23 | 24 | <% end %> 25 | 26 | int main() {} 27 | -------------------------------------------------------------------------------- /benchmark/type/any/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Bruno Dutra 2016 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets type any brigand list brigand.list.cpp.erb 15 "(0..50).step(10).to_a + (100..500).step(50).to_a") 7 | add_dataset(datasets type any kvasir list kvasir.list.cpp.erb 15 "(0..50).step(10).to_a + (100..500).step(50).to_a") 8 | add_dataset(datasets type any meta list meta.list.cpp.erb 15 "(0..50).step(10).to_a + (100..500).step(50).to_a") 9 | add_dataset(datasets type any metal list metal.list.cpp.erb 15 "(0..50).step(10).to_a + (100..500).step(50).to_a") 10 | add_dataset(datasets type any mp11 list mp11.list.cpp.erb 15 "(0..50).step(10).to_a + (100..500).step(50).to_a") 11 | 12 | add_chart(type any DATASETS ${datasets}) 13 | -------------------------------------------------------------------------------- /benchmark/type/any/brigand.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #define BRIGAND_NO_BOOST_SUPPORT 6 | #include 7 | 8 | template 9 | using equals_to = brigand::bool_; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 14 | 15 | using <%= "xs#{k}" %> = brigand::list<<%= ints.map { |i| "brigand::int32_t<#{i}>" }.join(', ') %>>; 16 | 17 | #if defined(METABENCH) 18 | using <%= "result#{k}" %> = brigand::any<<%= "xs#{k}" %>, brigand::bind>, brigand::_1>>; 19 | #endif 20 | 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/any/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | template 9 | struct equals_to { 10 | template 11 | using f = mpl::bool_; 12 | }; 13 | 14 | <% env[:k].times do |k| %> 15 | 16 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 17 | 18 | using <%= "xs#{k}" %> = mpl::list<<%= ints.map { |i| "mpl::int_<#{i}>" }.join(', ') %>>; 19 | 20 | #if defined(METABENCH) 21 | using <%= "result#{k}" %> = mpl::call>>>,<%= "xs#{k}" %>>; 22 | #endif 23 | 24 | <% end %> 25 | 26 | int main() {} 27 | -------------------------------------------------------------------------------- /benchmark/type/any/meta.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template 8 | struct equals_to { 9 | template 10 | using invoke = meta::bool_; 11 | }; 12 | 13 | <% env[:k].times do |k| %> 14 | 15 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 16 | 17 | using <%= "xs#{k}" %> = meta::list<<%= ints.map { |i| "meta::int_<#{i}>" }.join(', ') %>>; 18 | 19 | #if defined(METABENCH) 20 | using <%= "result#{k}" %> = meta::any_of<<%= "xs#{k}" %>, equals_to<<%= ints.last || 0 %>>>; 21 | #endif 22 | 23 | <% end %> 24 | 25 | int main() {} 26 | -------------------------------------------------------------------------------- /benchmark/type/any/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template 8 | struct equals_to { 9 | template 10 | using apply = metal::number; 11 | }; 12 | 13 | <% env[:k].times do |k| %> 14 | 15 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 16 | 17 | using <%= "xs#{k}" %> = metal::list<<%= ints.map { |i| "metal::number<#{i}>" }.join(', ') %>>; 18 | 19 | #if defined(METABENCH) 20 | using <%= "result#{k}" %> = metal::any_of<<%= "xs#{k}" %>, metal::lambda>::apply>>; 21 | #endif 22 | 23 | <% end %> 24 | 25 | int main() {} 26 | -------------------------------------------------------------------------------- /benchmark/type/any/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template 9 | struct equals_to { 10 | template 11 | using apply = mp_bool; 12 | }; 13 | 14 | <% env[:k].times do |k| %> 15 | 16 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 17 | 18 | using <%= "xs#{k}" %> = mp_list<<%= ints.map { |i| "std::integral_constant" }.join(', ') %>>; 19 | 20 | #if defined(METABENCH) 21 | using <%= "result#{k}" %> = mp_any_of<<%= "xs#{k}" %>, equals_to<<%= ints.last || 0 %>>::apply>; 22 | #endif 23 | 24 | <% end %> 25 | 26 | int main() {} 27 | -------------------------------------------------------------------------------- /benchmark/type/at/brigand.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | template struct x; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = brigand::list< 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 15 | >; 16 | 17 | <% (env[:p]*n/100).times do |p| %> 18 | #if defined(METABENCH) 19 | using <%= "result#{p}#{k}" %> = brigand::at<<%= "xs#{k}" %>, brigand::int32_t<<%= p*100/env[:p] %>>>; 20 | #endif 21 | 22 | <% end %> 23 | <% end %> 24 | 25 | int main() {} 26 | -------------------------------------------------------------------------------- /benchmark/type/at/hana.types.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | namespace hana = boost::hana; 8 | 9 | template struct x; 10 | 11 | int main() { 12 | <% env[:k].times do |k| %> 13 | constexpr auto <%= "xs#{k}" %> = hana::experimental::types< 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 15 | >{}; 16 | 17 | <% (env[:p]*n/100).times do |p| %> 18 | #if defined(METABENCH) 19 | constexpr auto <%= "result#{p}#{k}" %> = hana::at_c<<%= p*100/env[:p] %>>(<%= "xs#{k}" %>); 20 | #endif 21 | <% end %> 22 | <% end %> 23 | } 24 | -------------------------------------------------------------------------------- /benchmark/type/at/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = mpl::list< 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 14 | >; 15 | 16 | <% (env[:p]*n/100).times do |p| %> 17 | #if defined(METABENCH) 18 | using <%= "result#{p}#{k}" %> = mpl::eager::lookup<<%= "xs#{k}" %>, <%= p*100/env[:p] %>>; 19 | #endif 20 | <% end %> 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/at/meta.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template struct x; 8 | 9 | <% env[:k].times do |k| %> 10 | 11 | using <%= "xs#{k}" %> = meta::list< 12 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 13 | >; 14 | 15 | <% (env[:p]*n/100).times do |p| %> 16 | #if defined(METABENCH) 17 | using <%= "result#{p}#{k}" %> = meta::at_c<<%= "xs#{k}" %>, <%= p*100/env[:p] %>>; 18 | #endif 19 | <% end %> 20 | <% end %> 21 | 22 | int main() {} 23 | -------------------------------------------------------------------------------- /benchmark/type/at/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template struct x; 8 | 9 | <% env[:k].times do |k| %> 10 | 11 | using <%= "xs#{k}" %> = metal::list< 12 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 13 | >; 14 | 15 | <% (env[:p]*n/100).times do |p| %> 16 | #if defined(METABENCH) 17 | using <%= "result#{p}#{k}" %> = metal::at<<%= "xs#{k}" %>, metal::number<<%= p*100/env[:p] %>>>; 18 | #endif 19 | <% end %> 20 | <% end %> 21 | 22 | int main() {} 23 | -------------------------------------------------------------------------------- /benchmark/type/at/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = mp_list< 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 14 | >; 15 | 16 | <% (env[:p]*n/100).times do |p| %> 17 | #if defined(METABENCH) 18 | using <%= "result#{p}#{k}" %> = mp_at_c<<%= "xs#{k}" %>, <%= p*100/env[:p] %>>; 19 | #endif 20 | <% end %> 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/at/mpl.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_LIST_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | namespace mpl = boost::mpl; 13 | 14 | template struct x; 15 | 16 | <% env[:k].times do |k| %> 17 | 18 | using <%= "xs#{k}" %> = mpl::list< 19 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 20 | >; 21 | 22 | <% (env[:p]*n/100).times do |p| %> 23 | #if defined(METABENCH) 24 | using <%= "result#{p}#{k}" %> = mpl::at_c<<%= "xs#{k}" %>, <%= p*n/env[:p] %>>::type; 25 | #endif 26 | <% end %> 27 | <% end %> 28 | 29 | int main() { } 30 | -------------------------------------------------------------------------------- /benchmark/type/at/mpl.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_VECTOR_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | namespace mpl = boost::mpl; 13 | 14 | template struct x; 15 | 16 | <% env[:k].times do |k| %> 17 | 18 | using <%= "xs#{k}" %> = mpl::vector< 19 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 20 | >; 21 | 22 | <% (env[:p]*n/100).times do |p| %> 23 | #if defined(METABENCH) 24 | using <%= "result#{p}#{k}" %> = mpl::at_c<<%= "xs#{k}" %>, <%= p*n/env[:p] %>>::type; 25 | #endif 26 | <% end %> 27 | <% end %> 28 | 29 | int main() {} 30 | -------------------------------------------------------------------------------- /benchmark/type/cartesian_product/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Bruno Dutra 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets type cartesian_product kvasir list kvasir.list.cpp.erb 1 "(0..50).step(10).to_a + (100..200).step(50).to_a") 7 | add_dataset(datasets type cartesian_product meta list meta.list.cpp.erb 1 "(0..50).step(10).to_a + (100..100).step(50).to_a") 8 | add_dataset(datasets type cartesian_product metal list metal.list.cpp.erb 1 "(0..50).step(10).to_a + (100..400).step(50).to_a") 9 | add_dataset(datasets type cartesian_product mp11 list mp11.list.cpp.erb 1 "(0..50).step(10).to_a + (100..100).step(50).to_a") 10 | 11 | add_chart(type cartesian_product DATASETS ${datasets}) 12 | -------------------------------------------------------------------------------- /benchmark/type/cartesian_product/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | template struct x; 9 | template struct y; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = mpl::list<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 14 | using <%= "ys#{k}" %> = mpl::list<<%= ((k*n+1)..(k*n+n)).map { |i| "y<#{i}>" }.join(', ') %>>; 15 | 16 | #if defined(METABENCH) 17 | using <%= "result#{k}" %> = mpl::eager::product, <%= "ys#{k}" %>>>; 18 | #endif 19 | 20 | <% end %> 21 | 22 | int main() {} 23 | -------------------------------------------------------------------------------- /benchmark/type/cartesian_product/meta.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template struct x; 8 | template struct y; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = meta::list<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 13 | using <%= "ys#{k}" %> = meta::list<<%= ((k*n+1)..(k*n+n)).map { |i| "y<#{i}>" }.join(', ') %>>; 14 | 15 | #if defined(METABENCH) 16 | using <%= "result#{k}" %> = meta::cartesian_product, <%= "ys#{k}" %>>>; 17 | #endif 18 | 19 | <% end %> 20 | 21 | int main() {} 22 | -------------------------------------------------------------------------------- /benchmark/type/cartesian_product/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template struct x; 8 | template struct y; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = metal::list<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 13 | using <%= "ys#{k}" %> = metal::list<<%= ((k*n+1)..(k*n+n)).map { |i| "y<#{i}>" }.join(', ') %>>; 14 | 15 | #if defined(METABENCH) 16 | using <%= "result#{k}" %> = metal::cartesian<<%= "xs#{k}" %>, <%= "ys#{k}" %>>; 17 | #endif 18 | 19 | <% end %> 20 | 21 | int main() {} 22 | -------------------------------------------------------------------------------- /benchmark/type/cartesian_product/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template struct x; 9 | template struct y; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = mp_list<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 14 | using <%= "ys#{k}" %> = mp_list<<%= ((k*n+1)..(k*n+n)).map { |i| "y<#{i}>" }.join(', ') %>>; 15 | 16 | #if defined(METABENCH) 17 | using <%= "result#{k}" %> = mp_product, <%= "ys#{k}" %>>; 18 | #endif 19 | 20 | <% end %> 21 | 22 | int main() {} 23 | -------------------------------------------------------------------------------- /benchmark/type/count_if/brigand.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #define BRIGAND_NO_BOOST_SUPPORT 6 | #include 7 | 8 | template 9 | using is_even = brigand::bool_; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = brigand::list< 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "brigand::int32_t<#{i}>" }.join(', ') %> 15 | >; 16 | 17 | #if defined(METABENCH) 18 | using <%= "result#{k}" %> = brigand::count_if<<%= "xs#{k}" %>, brigand::bind>; 19 | #endif 20 | 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/count_if/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | 9 | struct is_even { 10 | template 11 | using f = mpl::int_; 12 | }; 13 | 14 | <% env[:k].times do |k| %> 15 | 16 | using <%= "xs#{k}" %> = mpl::list< 17 | <%= ((k*n+1)..(k*n+n)).map { |i| "mpl::int_<#{i}>" }.join(', ') %> 18 | >; 19 | 20 | #if defined(METABENCH) 21 | using <%= "result#{k}" %> = mpl::call>,<%= "xs#{k}" %>>; 22 | #endif 23 | 24 | <% end %> 25 | 26 | int main() {} 27 | -------------------------------------------------------------------------------- /benchmark/type/count_if/meta.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | struct is_even { 8 | template 9 | using invoke = meta::bool_; 10 | }; 11 | 12 | <% env[:k].times do |k| %> 13 | 14 | using <%= "xs#{k}" %> = meta::list< 15 | <%= ((k*n+1)..(k*n+n)).map { |i| "meta::int_<#{i}>" }.join(', ') %> 16 | >; 17 | 18 | #if defined(METABENCH) 19 | using <%= "result#{k}" %> = meta::count_if<<%= "xs#{k}" %>, is_even>; 20 | #endif 21 | 22 | <% end %> 23 | 24 | int main() {} 25 | -------------------------------------------------------------------------------- /benchmark/type/count_if/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template 8 | using is_even = metal::number; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = metal::list< 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "metal::number<#{i}>" }.join(', ') %> 14 | >; 15 | 16 | #if defined(METABENCH) 17 | using <%= "result#{k}" %> = metal::count_if<<%= "xs#{k}" %>, metal::lambda>; 18 | #endif 19 | 20 | <% end %> 21 | 22 | int main() {} 23 | -------------------------------------------------------------------------------- /benchmark/type/count_if/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template 9 | using is_even = mp_bool; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = mp_list< 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "mp_int<#{i}>" }.join(', ') %> 15 | >; 16 | 17 | #if defined(METABENCH) 18 | using <%= "result#{k}" %> = mp_count_if<<%= "xs#{k}" %>, is_even>; 19 | #endif 20 | 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/count_if/mpl.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_LIST_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | namespace mpl = boost::mpl; 15 | 16 | struct is_even { 17 | template 18 | using apply = mpl::bool_; 19 | }; 20 | 21 | <% env[:k].times do |k| %> 22 | 23 | using <%= "xs#{k}" %> = mpl::list< 24 | <%= ((k*n+1)..(k*n+n)).map { |i| "mpl::int_<#{i}>" }.join(', ') %> 25 | >; 26 | 27 | #if defined(METABENCH) 28 | using <%= "result#{k}" %> = mpl::count_if<<%= "xs#{k}" %>, is_even>::type; 29 | #endif 30 | 31 | <% end %> 32 | 33 | int main() {} 34 | -------------------------------------------------------------------------------- /benchmark/type/count_if/mpl.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_VECTOR_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | namespace mpl = boost::mpl; 15 | 16 | struct is_even { 17 | template 18 | using apply = mpl::bool_; 19 | }; 20 | 21 | <% env[:k].times do |k| %> 22 | 23 | using <%= "xs#{k}" %> = mpl::vector< 24 | <%= ((k*n+1)..(k*n+n)).map { |i| "mpl::int_<#{i}>" }.join(', ') %> 25 | >; 26 | 27 | #if defined(METABENCH) 28 | using <%= "result#{k}" %> = mpl::count_if<<%= "xs#{k}" %>, is_even>::type; 29 | #endif 30 | 31 | <% end %> 32 | 33 | int main() {} 34 | -------------------------------------------------------------------------------- /benchmark/type/distinct/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Bruno Dutra 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets type distinct metal list metal.list.cpp.erb 10 "(0..50).step(10).to_a + (100..500).step(50).to_a") 7 | add_dataset(datasets type distinct mp11 list mp11.list.cpp.erb 1 "(0..50).step(10).to_a + (100..500).step(50).to_a") 8 | 9 | add_chart(type distinct DATASETS ${datasets}) 10 | -------------------------------------------------------------------------------- /benchmark/type/distinct/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template struct x; 8 | 9 | <% env[:k].times do |k| %> 10 | 11 | #if defined(METABENCH) 12 | using <%= "result#{k}" %> = metal::distinct<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 13 | #endif 14 | <% end %> 15 | 16 | int main() {} 17 | -------------------------------------------------------------------------------- /benchmark/type/distinct/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template using distinct = std::is_same, mp_unique>>; 9 | 10 | template struct x; 11 | 12 | <% env[:k].times do |k| %> 13 | 14 | #if defined(METABENCH) 15 | using <%= "result#{k}" %> = distinct<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 16 | #endif 17 | <% end %> 18 | 19 | int main() {} 20 | -------------------------------------------------------------------------------- /benchmark/type/drop/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Bruno Dutra 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets type drop brigand list brigand.list.cpp.erb 100 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 7 | add_dataset(datasets type drop kvasir list kvasir.list.cpp.erb 100 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 8 | add_dataset(datasets type drop metal list metal.list.cpp.erb 100 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 9 | add_dataset(datasets type drop meta list meta.list.cpp.erb 100 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 10 | add_dataset(datasets type drop mp11 list mp11.list.cpp.erb 100 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 11 | 12 | add_chart(type drop DATASETS ${datasets}) 13 | -------------------------------------------------------------------------------- /benchmark/type/drop/brigand.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | template struct x; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = brigand::list<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 14 | 15 | #if defined(METABENCH) 16 | using <%= "result#{k}" %> = brigand::pop_front<<%= "xs#{k}" %>, brigand::int32_t<<%= k*n/env[:k] %>>>; 17 | #endif 18 | 19 | <% end %> 20 | 21 | int main() {} 22 | -------------------------------------------------------------------------------- /benchmark/type/drop/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = mpl::list<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 13 | 14 | #if defined(METABENCH) 15 | using <%= "result#{k}" %> = mpl::call>>>, <%= "xs#{k}" %>>; 16 | #endif 17 | <% end %> 18 | 19 | int main() {} 20 | -------------------------------------------------------------------------------- /benchmark/type/drop/meta.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | <% env[:k].times do |k| %> 8 | 9 | using <%= "xs#{k}" %> = meta::list< 10 | <%= ((k*n+1)..(k*n+n)).map { |i| "meta::int_<#{i}>" }.join(', ') %> 11 | >; 12 | 13 | #if defined(METABENCH) 14 | using <%= "result#{k}" %> = meta::drop<<%= "xs#{k}" %>, meta::size_t<<%= k*n/env[:k] %>>>; 15 | #endif 16 | 17 | <% end %> 18 | 19 | int main() {} 20 | -------------------------------------------------------------------------------- /benchmark/type/drop/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template struct x; 8 | 9 | <% env[:k].times do |k| %> 10 | 11 | using <%= "xs#{k}" %> = metal::list<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 12 | 13 | #if defined(METABENCH) 14 | using <%= "result#{k}" %> = metal::drop<<%= "xs#{k}" %>, metal::number<<%= k*n/env[:k] %>>>; 15 | #endif 16 | <% end %> 17 | 18 | int main() {} 19 | -------------------------------------------------------------------------------- /benchmark/type/drop/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = mp_list<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 13 | 14 | #if defined(METABENCH) 15 | using <%= "result#{k}" %> = mp_drop_c<<%= "xs#{k}" %>, <%= k*n/env[:k] %>>; 16 | #endif 17 | <% end %> 18 | 19 | int main() {} 20 | -------------------------------------------------------------------------------- /benchmark/type/erase/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Bruno Dutra 2016 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets type erase brigand list brigand.list.cpp.erb 60 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 7 | add_dataset(datasets type erase kvasir list kvasir.list.cpp.erb 60 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 8 | add_dataset(datasets type erase metal list metal.list.cpp.erb 60 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 9 | add_dataset(datasets type erase mp11 list mp11.list.cpp.erb 60 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 10 | add_dataset(datasets type erase mpl list mpl.list.cpp.erb 12 "[1] + (10..50).step(10).to_a") 11 | add_dataset(datasets type erase mpl vector mpl.vector.cpp.erb 12 "[1] + (10..50).step(10).to_a") 12 | 13 | add_chart(type erase DATASETS ${datasets}) 14 | -------------------------------------------------------------------------------- /benchmark/type/erase/brigand.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #define BRIGAND_NO_BOOST_SUPPORT 6 | #include 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = brigand::list< 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 14 | >; 15 | 16 | #if defined(METABENCH) 17 | using <%= "result#{k}" %> = brigand::erase<<%= "xs#{k}" %>, brigand::int32_t<<%= k*n/env[:k] %>>>; 18 | #endif 19 | 20 | <% end %> 21 | 22 | int main() {} 23 | -------------------------------------------------------------------------------- /benchmark/type/erase/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = mpl::list< 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 14 | >; 15 | 16 | #if defined(METABENCH) 17 | using <%= "result#{k}" %> = mpl::call>>>,<%= "xs#{k}" %>>; 18 | #endif 19 | 20 | <% end %> 21 | 22 | int main() {} 23 | -------------------------------------------------------------------------------- /benchmark/type/erase/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template struct x; 8 | 9 | <% env[:k].times do |k| %> 10 | 11 | using <%= "xs#{k}" %> = metal::list< 12 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 13 | >; 14 | 15 | #if defined(METABENCH) 16 | using <%= "result#{k}" %> = metal::erase<<%= "xs#{k}" %>, metal::number<<%= k*n/env[:k] %>>>; 17 | #endif 18 | 19 | <% end %> 20 | 21 | int main() {} 22 | -------------------------------------------------------------------------------- /benchmark/type/erase/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = mp_list< 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 14 | >; 15 | 16 | #if defined(METABENCH) 17 | using <%= "result#{k}" %> = mp_append, <%= k*n/env[:k] %>>, mp_drop_c<<%= "xs#{k}" %>, <%= k*n/env[:k] %> + 1>>; 18 | #endif 19 | 20 | <% end %> 21 | 22 | int main() {} 23 | -------------------------------------------------------------------------------- /benchmark/type/erase/mpl.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_LIST_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | namespace mpl = boost::mpl; 16 | 17 | template struct x; 18 | 19 | <% env[:k].times do |k| %> 20 | 21 | using <%= "xs#{k}" %> = mpl::list< 22 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 23 | >; 24 | 25 | using <%= "pos#{k}" %> = mpl::advance>::type, mpl::int_<<%= k*n/env[:k] %>>>::type; 26 | 27 | #if defined(METABENCH) 28 | using <%= "result#{k}" %> = mpl::erase<<%= "xs#{k}" %>, <%= "pos#{k}" %>>::type; 29 | #endif 30 | 31 | <% end %> 32 | 33 | int main() {} 34 | -------------------------------------------------------------------------------- /benchmark/type/erase/mpl.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_VECTOR_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | namespace mpl = boost::mpl; 16 | 17 | template struct x; 18 | 19 | <% env[:k].times do |k| %> 20 | 21 | using <%= "xs#{k}" %> = mpl::vector< 22 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 23 | >; 24 | 25 | using <%= "pos#{k}" %> = mpl::advance>::type, mpl::int_<<%= k*n/env[:k] %>>>::type; 26 | 27 | #if defined(METABENCH) 28 | using <%= "result#{k}" %> = mpl::erase<<%= "xs#{k}" %>, <%= "pos#{k}" %>>::type; 29 | #endif 30 | 31 | <% end %> 32 | 33 | int main() {} 34 | -------------------------------------------------------------------------------- /benchmark/type/filter/brigand.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #define BRIGAND_NO_BOOST_SUPPORT 6 | #include 7 | 8 | template 9 | using is_even = brigand::bool_; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = brigand::list< 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "brigand::int32_t<#{i}>" }.join(', ') %> 15 | >; 16 | 17 | #if defined(METABENCH) 18 | using <%= "result#{k}" %> = brigand::filter<<%= "xs#{k}" %>, brigand::bind>; 19 | #endif 20 | 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/filter/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | template 9 | using is_even = mpl::bool_; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = mpl::list< 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "mpl::int_<#{i}>" }.join(', ') %> 15 | >; 16 | 17 | #if defined(METABENCH) 18 | using <%= "result#{k}" %> = mpl::eager::filter<<%= "xs#{k}" %>,is_even>; 19 | #endif 20 | 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/filter/meta.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | struct is_even { 8 | template 9 | using invoke = meta::bool_; 10 | }; 11 | 12 | <% env[:k].times do |k| %> 13 | 14 | using <%= "xs#{k}" %> = meta::list< 15 | <%= ((k*n+1)..(k*n+n)).map { |i| "meta::int_<#{i}>" }.join(', ') %> 16 | >; 17 | 18 | #if defined(METABENCH) 19 | using <%= "result#{k}" %> = meta::filter<<%= "xs#{k}" %>, is_even>; 20 | #endif 21 | 22 | <% end %> 23 | 24 | int main() {} 25 | -------------------------------------------------------------------------------- /benchmark/type/filter/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template 8 | using is_even = metal::number; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = metal::list< 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "metal::number<#{i}>" }.join(', ') %> 14 | >; 15 | 16 | #if defined(METABENCH) 17 | using <%= "result#{k}" %> = metal::copy_if<<%= "xs#{k}" %>, metal::lambda>; 18 | #endif 19 | 20 | <% end %> 21 | 22 | int main() {} 23 | -------------------------------------------------------------------------------- /benchmark/type/filter/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template 9 | using is_even = mp_int; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = mp_list< 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "mp_int<#{i}>" }.join(', ') %> 15 | >; 16 | 17 | #if defined(METABENCH) 18 | using <%= "result#{k}" %> = mp_copy_if<<%= "xs#{k}" %>, is_even>; 19 | #endif 20 | 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/filter/mpl.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_LIST_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | namespace mpl = boost::mpl; 15 | 16 | struct is_even { 17 | template 18 | using apply = mpl::bool_; 19 | }; 20 | 21 | <% env[:k].times do |k| %> 22 | 23 | using <%= "xs#{k}" %> = mpl::list< 24 | <%= ((k*n+1)..(k*n+n)).map { |i| "mpl::int_<#{i}>" }.join(', ') %> 25 | >; 26 | 27 | #if defined(METABENCH) 28 | using <%= "result#{k}" %> = mpl::copy_if<<%= "xs#{k}" %>, is_even>::type; 29 | #endif 30 | 31 | <% end %> 32 | 33 | int main() {} 34 | -------------------------------------------------------------------------------- /benchmark/type/filter/mpl.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_VECTOR_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | namespace mpl = boost::mpl; 15 | 16 | struct is_even { 17 | template 18 | using apply = mpl::bool_; 19 | }; 20 | 21 | <% env[:k].times do |k| %> 22 | 23 | using <%= "xs#{k}" %> = mpl::vector< 24 | <%= ((k*n+1)..(k*n+n)).map { |i| "mpl::int_<#{i}>" }.join(', ') %> 25 | >; 26 | 27 | #if defined(METABENCH) 28 | using <%= "result#{k}" %> = mpl::copy_if<<%= "xs#{k}" %>, is_even>::type; 29 | #endif 30 | 31 | <% end %> 32 | 33 | int main() {} 34 | -------------------------------------------------------------------------------- /benchmark/type/filter/tmp.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2018 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace tmp = boost::tmp; 7 | 8 | template 9 | using is_even = tmp::bool_; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = tmp::list_< 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "tmp::int_<#{i}>" }.join(', ') %> 15 | >; 16 | 17 | #if defined(METABENCH) 18 | using <%= "result#{k}" %> = tmp::call_>>,<%= "xs#{k}" %>>; 19 | #endif 20 | 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/find_if/brigand.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #define BRIGAND_NO_BOOST_SUPPORT 6 | #include 7 | 8 | template 9 | using equals_to = brigand::bool_; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 14 | 15 | using <%= "xs#{k}" %> = brigand::list< 16 | <%= ints.map { |i| "brigand::int32_t<#{i}>" }.join(', ') %> 17 | >; 18 | 19 | #if defined(METABENCH) 20 | using <%= "result#{k}" %> = brigand::find<<%= "xs#{k}" %>, brigand::bind>, brigand::_1>>; 21 | #endif 22 | 23 | <% end %> 24 | 25 | int main() {} 26 | -------------------------------------------------------------------------------- /benchmark/type/find_if/hana.std_integer_sequence.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | namespace hana = boost::hana; 12 | 13 | 14 | template 15 | struct equals_to { 16 | template 17 | constexpr hana::bool_ operator()(Y const&) const; 18 | }; 19 | 20 | int main() { 21 | <% env[:k].times do |k| %> 22 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 23 | constexpr auto <%= "xs#{k}" %> = std::integer_sequence< 24 | <%= (["int"] + ints).join(', ') %> 25 | >{}; 26 | 27 | #if defined(METABENCH) 28 | constexpr auto <%= "result#{k}" %> = hana::find_if(<%= "xs#{k}" %>, equals_to<<%= ints.last || 0 %>>{}); 29 | #endif 30 | <% end %> 31 | } 32 | -------------------------------------------------------------------------------- /benchmark/type/find_if/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | 9 | template 10 | struct equals_to { 11 | template 12 | using apply = mpl::bool_; 13 | }; 14 | 15 | <% env[:k].times do |k| %> 16 | 17 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 18 | 19 | using <%= "xs#{k}" %> = mpl::list< 20 | <%= ints.map { |i| "mpl::int_<#{i}>" }.join(', ') %> 21 | >; 22 | 23 | #if defined(METABENCH) 24 | using <%= "result#{k}" %> = mpl::eager::find_if<<%= "xs#{k}" %>, equals_to<<%= ints.last || 0 %>>::apply>; 25 | #endif 26 | 27 | <% end %> 28 | 29 | int main() {} 30 | -------------------------------------------------------------------------------- /benchmark/type/find_if/meta.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template 8 | struct equals_to { 9 | template 10 | using invoke = meta::bool_; 11 | }; 12 | 13 | <% env[:k].times do |k| %> 14 | 15 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 16 | 17 | using <%= "xs#{k}" %> = meta::list< 18 | <%= ints.map { |i| "meta::int_<#{i}>" }.join(', ') %> 19 | >; 20 | 21 | #if defined(METABENCH) 22 | using <%= "result#{k}" %> = meta::find_if<<%= "xs#{k}" %>, equals_to<<%= ints.last || 0 %>>>; 23 | #endif 24 | 25 | <% end %> 26 | 27 | int main() {} 28 | -------------------------------------------------------------------------------- /benchmark/type/find_if/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template 8 | struct equals_to { 9 | template 10 | using apply = metal::number; 11 | }; 12 | 13 | <% env[:k].times do |k| %> 14 | 15 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 16 | 17 | using <%= "xs#{k}" %> = metal::list< 18 | <%= ints.map { |i| "metal::number<#{i}>" }.join(', ') %> 19 | >; 20 | 21 | #if defined(METABENCH) 22 | using <%= "result#{k}" %> = metal::find_if<<%= "xs#{k}" %>, metal::lambda>::apply>>; 23 | #endif 24 | 25 | <% end %> 26 | 27 | int main() {} 28 | -------------------------------------------------------------------------------- /benchmark/type/find_if/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template 9 | struct equals_to { 10 | template 11 | using apply = mp_bool; 12 | }; 13 | 14 | <% env[:k].times do |k| %> 15 | 16 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 17 | 18 | using <%= "xs#{k}" %> = mp_list< 19 | <%= ints.map { |i| "mp_int<#{i}>" }.join(', ') %> 20 | >; 21 | 22 | #if defined(METABENCH) 23 | using <%= "result#{k}" %> = mp_find_if<<%= "xs#{k}" %>, equals_to<<%= ints.last || 0 %>>::apply>; 24 | #endif 25 | 26 | <% end %> 27 | 28 | int main() {} 29 | -------------------------------------------------------------------------------- /benchmark/type/find_if/tmp.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2018 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include "boost/tmp.hpp" 6 | 7 | namespace tmp = boost::tmp; 8 | 9 | template 10 | struct equals_to { 11 | template 12 | using apply = tmp::bool_; 13 | }; 14 | 15 | <% env[:k].times do |k| %> 16 | 17 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 18 | 19 | using <%= "xs#{k}" %> = tmp::list_< 20 | <%= ints.map { |i| "tmp::int_<#{i}>" }.join(', ') %> 21 | >; 22 | 23 | #if defined(METABENCH) 24 | using <%= "result#{k}" %> = tmp::call_>::apply>>>,<%= "xs#{k}" %>>; 25 | #endif 26 | 27 | <% end %> 28 | 29 | int main() {} 30 | -------------------------------------------------------------------------------- /benchmark/type/fold_left/brigand.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #define BRIGAND_NO_BOOST_SUPPORT 6 | #include 7 | 8 | template 9 | using F = X; 10 | 11 | struct state; 12 | 13 | template struct x; 14 | 15 | <% env[:k].times do |k| %> 16 | 17 | using <%= "xs#{k}" %> = brigand::list< 18 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 19 | >; 20 | 21 | #if defined(METABENCH) 22 | using <%= "result#{k}" %> = brigand::fold<<%= "xs#{k}" %>, state, brigand::bind>; 23 | #endif 24 | 25 | <% end %> 26 | 27 | int main() {} 28 | -------------------------------------------------------------------------------- /benchmark/type/fold_left/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | template 9 | using f = X; 10 | 11 | struct state; 12 | 13 | template struct x; 14 | 15 | <% env[:k].times do |k| %> 16 | 17 | using <%= "xs#{k}" %> = mpl::list< 18 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 19 | >; 20 | 21 | #if defined(METABENCH) 22 | using <%= "result#{k}" %> = mpl::eager::fold_left<<%= "xs#{k}" %>, state, f>; 23 | #endif 24 | 25 | <% end %> 26 | 27 | int main() {} 28 | -------------------------------------------------------------------------------- /benchmark/type/fold_left/meta.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | struct f { 8 | template 9 | using invoke = X; 10 | }; 11 | 12 | struct state; 13 | 14 | template struct x; 15 | 16 | <% env[:k].times do |k| %> 17 | 18 | using <%= "xs#{k}" %> = meta::list< 19 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 20 | >; 21 | 22 | #if defined(METABENCH) 23 | using <%= "result#{k}" %> = meta::fold<<%= "xs#{k}" %>, state, f>; 24 | #endif 25 | 26 | <% end %> 27 | 28 | int main() {} 29 | -------------------------------------------------------------------------------- /benchmark/type/fold_left/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template 8 | using f = X; 9 | 10 | struct state; 11 | 12 | template struct x; 13 | 14 | <% env[:k].times do |k| %> 15 | 16 | using <%= "xs#{k}" %> = metal::list< 17 | metal::lambda, state<%= ((k*n+1)..(k*n+n)).map { |i| ", x<#{i}>" }.join('') %> 18 | >; 19 | 20 | #if defined(METABENCH) 21 | using <%= "result#{k}" %> = metal::apply, <%= "xs#{k}" %>>; 22 | #endif 23 | 24 | <% end %> 25 | 26 | int main() {} 27 | -------------------------------------------------------------------------------- /benchmark/type/fold_left/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template 9 | using f = X; 10 | 11 | struct state; 12 | 13 | template struct x; 14 | 15 | <% env[:k].times do |k| %> 16 | 17 | using <%= "xs#{k}" %> = mp_list< 18 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 19 | >; 20 | 21 | #if defined(METABENCH) 22 | using <%= "result#{k}" %> = mp_fold<<%= "xs#{k}" %>, state, f>; 23 | #endif 24 | 25 | <% end %> 26 | 27 | int main() {} 28 | -------------------------------------------------------------------------------- /benchmark/type/fold_left/mpl.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_LIST_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | namespace mpl = boost::mpl; 13 | 14 | struct f { 15 | template 16 | struct apply { 17 | using type = X; 18 | }; 19 | }; 20 | 21 | struct state; 22 | 23 | template struct x; 24 | 25 | <% env[:k].times do |k| %> 26 | 27 | using <%= "xs#{k}" %> = mpl::list< 28 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 29 | >; 30 | 31 | #if defined(METABENCH) 32 | using <%= "result#{k}" %> = mpl::fold<<%= "xs#{k}" %>, state, f>::type; 33 | #endif 34 | 35 | <% end %> 36 | 37 | int main() {} 38 | -------------------------------------------------------------------------------- /benchmark/type/fold_left/mpl.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_VECTOR_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | namespace mpl = boost::mpl; 13 | 14 | struct f { 15 | template 16 | struct apply { 17 | using type = X; 18 | }; 19 | }; 20 | 21 | struct state; 22 | 23 | template struct x; 24 | 25 | <% env[:k].times do |k| %> 26 | 27 | using <%= "xs#{k}" %> = mpl::vector< 28 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 29 | >; 30 | 31 | #if defined(METABENCH) 32 | using <%= "result#{k}" %> = mpl::fold<<%= "xs#{k}" %>, state, f>::type; 33 | #endif 34 | 35 | <% end %> 36 | 37 | int main() {} 38 | -------------------------------------------------------------------------------- /benchmark/type/fold_right/brigand.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #define BRIGAND_NO_BOOST_SUPPORT 6 | #include 7 | 8 | template 9 | using F = X; 10 | 11 | struct state; 12 | 13 | template struct x; 14 | 15 | <% env[:k].times do |k| %> 16 | 17 | using <%= "xs#{k}" %> = brigand::list< 18 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 19 | >; 20 | 21 | #if defined(METABENCH) 22 | using <%= "result#{k}" %> = brigand::reverse_fold<<%= "xs#{k}" %>, state, brigand::bind>; 23 | #endif 24 | 25 | <% end %> 26 | 27 | int main() {} 28 | -------------------------------------------------------------------------------- /benchmark/type/fold_right/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | template 9 | using f = X; 10 | 11 | struct state; 12 | 13 | template struct x; 14 | 15 | <% env[:k].times do |k| %> 16 | 17 | using <%= "xs#{k}" %> = mpl::list< 18 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 19 | >; 20 | 21 | #if defined(METABENCH) 22 | using <%= "result#{k}" %> = mpl::eager::fold_right<<%= "xs#{k}" %>, state, f>; 23 | #endif 24 | 25 | <% end %> 26 | 27 | int main() {} 28 | -------------------------------------------------------------------------------- /benchmark/type/fold_right/meta.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | struct f { 8 | template 9 | using invoke = X; 10 | }; 11 | 12 | struct state; 13 | 14 | template struct x; 15 | 16 | <% env[:k].times do |k| %> 17 | 18 | using <%= "xs#{k}" %> = meta::list< 19 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 20 | >; 21 | 22 | #if defined(METABENCH) 23 | using <%= "result#{k}" %> = meta::reverse_fold<<%= "xs#{k}" %>, state, f>; 24 | #endif 25 | 26 | <% end %> 27 | 28 | int main() {} 29 | -------------------------------------------------------------------------------- /benchmark/type/fold_right/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template 8 | using f = X; 9 | 10 | struct state; 11 | 12 | template struct x; 13 | 14 | <% env[:k].times do |k| %> 15 | 16 | using <%= "xs#{k}" %> = metal::list< 17 | metal::lambda, state<%= ((k*n+1)..(k*n+n)).map { |i| ", x<#{i}>" }.join('') %> 18 | >; 19 | 20 | #if defined(METABENCH) 21 | using <%= "result#{k}" %> = metal::apply, <%= "xs#{k}" %>>; 22 | #endif 23 | 24 | <% end %> 25 | 26 | int main() {} 27 | -------------------------------------------------------------------------------- /benchmark/type/fold_right/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template 9 | using f = X; 10 | 11 | struct state; 12 | 13 | template struct x; 14 | 15 | <% env[:k].times do |k| %> 16 | 17 | using <%= "xs#{k}" %> = mp_list< 18 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 19 | >; 20 | 21 | #if defined(METABENCH) 22 | using <%= "result#{k}" %> = mp_reverse_fold<<%= "xs#{k}" %>, state, f>; 23 | #endif 24 | 25 | <% end %> 26 | 27 | int main() {} 28 | -------------------------------------------------------------------------------- /benchmark/type/fold_right/mpl.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_LIST_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | namespace mpl = boost::mpl; 13 | 14 | struct f { 15 | template 16 | struct apply { 17 | using type = X; 18 | }; 19 | }; 20 | 21 | struct state; 22 | 23 | template struct x; 24 | 25 | <% env[:k].times do |k| %> 26 | 27 | using <%= "xs#{k}" %> = mpl::list< 28 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 29 | >; 30 | 31 | #if defined(METABENCH) 32 | using <%= "result#{k}" %> = mpl::reverse_fold<<%= "xs#{k}" %>, state, f>::type; 33 | #endif 34 | 35 | <% end %> 36 | 37 | int main() {} 38 | -------------------------------------------------------------------------------- /benchmark/type/fold_right/mpl.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_VECTOR_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | namespace mpl = boost::mpl; 13 | 14 | struct f { 15 | template 16 | struct apply { 17 | using type = X; 18 | }; 19 | }; 20 | 21 | struct state; 22 | 23 | template struct x; 24 | 25 | <% env[:k].times do |k| %> 26 | 27 | using <%= "xs#{k}" %> = mpl::vector< 28 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 29 | >; 30 | 31 | #if defined(METABENCH) 32 | using <%= "result#{k}" %> = mpl::reverse_fold<<%= "xs#{k}" %>, state, f>::type; 33 | #endif 34 | 35 | <% end %> 36 | 37 | int main() {} 38 | -------------------------------------------------------------------------------- /benchmark/type/insert/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Bruno Dutra 2016 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets type insert kvasir list kvasir.list.cpp.erb 40 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 7 | add_dataset(datasets type insert metal list metal.list.cpp.erb 40 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 8 | add_dataset(datasets type insert mp11 list mp11.list.cpp.erb 40 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 9 | add_dataset(datasets type insert mpl list mpl.list.cpp.erb 10 "[1] + (10..50).step(10).to_a") 10 | add_dataset(datasets type insert mpl vector mpl.vector.cpp.erb 10 "[1] + (10..50).step(10).to_a") 11 | 12 | add_chart(type insert DATASETS ${datasets}) 13 | -------------------------------------------------------------------------------- /benchmark/type/insert/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = mpl::list< 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 14 | >; 15 | 16 | #if defined(METABENCH) 17 | using <%= "result#{k}" %> = mpl::eager::insert<<%= "xs#{k}" %>, <%= k*n/env[:k] %>, void>; 18 | #endif 19 | 20 | <% end %> 21 | 22 | int main() {} 23 | -------------------------------------------------------------------------------- /benchmark/type/insert/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template struct x; 8 | 9 | <% env[:k].times do |k| %> 10 | 11 | using <%= "xs#{k}" %> = metal::list< 12 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 13 | >; 14 | 15 | #if defined(METABENCH) 16 | using <%= "result#{k}" %> = metal::insert<<%= "xs#{k}" %>, metal::number<<%= k*n/env[:k] %>>, void>; 17 | #endif 18 | 19 | <% end %> 20 | 21 | int main() {} 22 | -------------------------------------------------------------------------------- /benchmark/type/insert/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = mp_list< 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 14 | >; 15 | 16 | #if defined(METABENCH) 17 | using <%= "result#{k}" %> = mp_append, <%= k*n/env[:k] %>>, void>, mp_drop_c<<%= "xs#{k}" %>, <%= k*n/env[:k] %>>>; 18 | #endif 19 | 20 | <% end %> 21 | 22 | int main() {} 23 | -------------------------------------------------------------------------------- /benchmark/type/insert/mpl.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_LIST_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | namespace mpl = boost::mpl; 16 | 17 | template struct x; 18 | 19 | <% env[:k].times do |k| %> 20 | 21 | using <%= "xs#{k}" %> = mpl::list< 22 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 23 | >; 24 | 25 | using <%= "pos#{k}" %> = mpl::advance>::type, mpl::int_<<%= k*n/env[:k] %>>>::type; 26 | 27 | #if defined(METABENCH) 28 | using <%= "result#{k}" %> = mpl::insert<<%= "xs#{k}" %>, <%= "pos#{k}" %>, void>::type; 29 | #endif 30 | 31 | <% end %> 32 | 33 | int main() {} 34 | -------------------------------------------------------------------------------- /benchmark/type/join/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Bruno Dutra 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets type join brigand list brigand.list.cpp.erb 1 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 7 | add_dataset(datasets type join kvasir list kvasir.list.cpp.erb 1 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 8 | add_dataset(datasets type join tmp list tmp.list.cpp.erb 1 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 9 | add_dataset(datasets type join meta list meta.list.cpp.erb 1 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 10 | add_dataset(datasets type join metal list metal.list.cpp.erb 1 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 11 | add_dataset(datasets type join mp11 list mp11.list.cpp.erb 1 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 12 | 13 | add_chart(type join DATASETS ${datasets}) 14 | -------------------------------------------------------------------------------- /benchmark/type/join/brigand.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #define BRIGAND_NO_BOOST_SUPPORT 6 | #include 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 13 | 14 | <% for i in ints %> 15 | using <%= "xs#{k}#{i}" %> = brigand::list<<%= (0..100).map { |j| "x<#{i}, #{j}>" }.join(', ') %>>; 16 | <% end %> 17 | 18 | #if defined(METABENCH) 19 | using <%= "result#{k}" %> = brigand::append<<%= ints.map { |i| "xs#{k}#{i}" }.join(', ') %>>; 20 | #endif 21 | 22 | <% end %> 23 | 24 | int main() {} 25 | -------------------------------------------------------------------------------- /benchmark/type/join/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 13 | 14 | <% for i in ints %> 15 | using <%= "xs#{k}#{i}" %> = mpl::list<<%= (0..100).map { |j| "x<#{i}, #{j}>" }.join(', ') %>>; 16 | <% end %> 17 | 18 | #if defined(METABENCH) 19 | using <%= "result#{k}" %> = mpl::eager::join<<%= ints.map { |i| "xs#{k}#{i}" }.join(', ') %>>; 20 | #endif 21 | 22 | <% end %> 23 | 24 | int main() {} 25 | -------------------------------------------------------------------------------- /benchmark/type/join/meta.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template struct x; 8 | 9 | <% env[:k].times do |k| %> 10 | 11 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 12 | 13 | <% for i in ints %> 14 | using <%= "xs#{k}#{i}" %> = meta::list<<%= (0..100).map { |j| "x<#{i}, #{j}>" }.join(', ') %>>; 15 | <% end %> 16 | 17 | #if defined(METABENCH) 18 | using <%= "result#{k}" %> = meta::join>>; 19 | #endif 20 | 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/join/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template struct x; 8 | 9 | <% env[:k].times do |k| %> 10 | 11 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 12 | 13 | <% for i in ints %> 14 | using <%= "xs#{k}#{i}" %> = metal::list<<%= (0..100).map { |j| "x<#{i}, #{j}>" }.join(', ') %>>; 15 | <% end %> 16 | 17 | #if defined(METABENCH) 18 | using <%= "result#{k}" %> = metal::join<<%= ints.map { |i| "xs#{k}#{i}" }.join(', ') %>>; 19 | #endif 20 | 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/join/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 13 | 14 | <% for i in ints %> 15 | using <%= "xs#{k}#{i}" %> = mp_list<<%= (0..100).map { |j| "x<#{i}, #{j}>" }.join(', ') %>>; 16 | <% end %> 17 | 18 | #if defined(METABENCH) 19 | using <%= "result#{k}" %> = mp_append<<%= ints.map { |i| "xs#{k}#{i}" }.join(', ') %>>; 20 | #endif 21 | 22 | <% end %> 23 | 24 | int main() {} 25 | -------------------------------------------------------------------------------- /benchmark/type/join/tmp.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2018 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | 8 | 9 | namespace tmp = boost::tmp; 10 | 11 | 12 | template struct x; 13 | 14 | <% env[:k].times do |k| %> 15 | 16 | <% ints = ((k*n+1)..(k*n+n)).to_a %> 17 | 18 | <% for i in ints %> 19 | using <%= "xs#{k}#{i}" %> = tmp::list_<<%= (0..100).map { |j| "x<#{i}, #{j}>" }.join(', ') %>>; 20 | <% end %> 21 | 22 | #if defined(METABENCH) 23 | using <%= "result#{k}" %> = tmp::call_,<%= ints.map { |i| "xs#{k}#{i}" }.join(', ') %>>; 24 | #endif 25 | 26 | <% end %> 27 | 28 | int main() {} 29 | -------------------------------------------------------------------------------- /benchmark/type/make/brigand.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #define BRIGAND_NO_BOOST_SUPPORT 6 | #include 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | #if defined(METABENCH) 13 | using <%= "xs#{k}" %> = brigand::list< 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 15 | >; 16 | #endif 17 | 18 | <% end %> 19 | 20 | int main() {} 21 | -------------------------------------------------------------------------------- /benchmark/type/make/hana.types.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | namespace hana = boost::hana; 8 | 9 | template struct x; 10 | 11 | int main() { 12 | <% env[:k].times do |k| %> 13 | #if defined(METABENCH) 14 | constexpr auto <%= "xs#{k}" %> = hana::experimental::types< 15 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 16 | >{}; 17 | #endif 18 | <% end %> 19 | } 20 | -------------------------------------------------------------------------------- /benchmark/type/make/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | template struct x; 8 | 9 | <% env[:k].times do |k| %> 10 | 11 | #if defined(METABENCH) 12 | using <%= "xs#{k}" %> = mpl::list<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 13 | #endif 14 | 15 | <% end %> 16 | 17 | int main() {} 18 | -------------------------------------------------------------------------------- /benchmark/type/make/meta.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template struct x; 8 | 9 | <% env[:k].times do |k| %> 10 | 11 | #if defined(METABENCH) 12 | using <%= "xs#{k}" %> = meta::list<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 13 | #endif 14 | 15 | <% end %> 16 | 17 | int main() {} 18 | -------------------------------------------------------------------------------- /benchmark/type/make/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template struct x; 8 | 9 | <% env[:k].times do |k| %> 10 | 11 | #if defined(METABENCH) 12 | using <%= "xs#{k}" %> = metal::list<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 13 | #endif 14 | 15 | <% end %> 16 | 17 | int main() {} 18 | -------------------------------------------------------------------------------- /benchmark/type/make/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | #if defined(METABENCH) 13 | using <%= "xs#{k}" %> = mp_list<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 14 | #endif 15 | 16 | <% end %> 17 | 18 | int main() {} 19 | -------------------------------------------------------------------------------- /benchmark/type/make/mpl.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_LIST_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | namespace mpl = boost::mpl; 12 | 13 | template struct x; 14 | 15 | <% env[:k].times do |k| %> 16 | 17 | #if defined(METABENCH) 18 | using <%= "xs#{k}" %> = mpl::list<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 19 | #endif 20 | 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/make/mpl.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_VECTOR_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | namespace mpl = boost::mpl; 12 | 13 | template struct x; 14 | 15 | <% env[:k].times do |k| %> 16 | 17 | #if defined(METABENCH) 18 | using <%= "xs#{k}" %> = mpl::vector<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 19 | #endif 20 | 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/partition/brigand.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #define BRIGAND_NO_BOOST_SUPPORT 6 | #include 7 | 8 | template 9 | using is_even = brigand::bool_; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = brigand::list< 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "brigand::int32_t<#{i}>" }.join(', ') %> 15 | >; 16 | 17 | #if defined(METABENCH) 18 | using <%= "result#{k}" %> = brigand::partition<<%= "xs#{k}" %>, brigand::bind>; 19 | #endif 20 | 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/partition/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | template 9 | using is_even = mpl::bool_; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = mpl::list< 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "mpl::int_<#{i}>" }.join(', ') %> 15 | >; 16 | 17 | #if defined(METABENCH) 18 | using <%= "result#{k}" %> = mpl::eager::partition<<%= "xs#{k}" %>,is_even>; 19 | #endif 20 | 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/partition/meta.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | 8 | struct is_even { 9 | template 10 | using invoke = meta::bool_; 11 | }; 12 | 13 | <% env[:k].times do |k| %> 14 | 15 | using <%= "xs#{k}" %> = meta::list< 16 | <%= ((k*n+1)..(k*n+n)).map { |i| "meta::int_<#{i}>" }.join(', ') %> 17 | >; 18 | 19 | #if defined(METABENCH) 20 | using <%= "result#{k}" %> = meta::partition<<%= "xs#{k}" %>, is_even>; 21 | #endif 22 | 23 | <% end %> 24 | 25 | int main() {} 26 | -------------------------------------------------------------------------------- /benchmark/type/partition/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template 8 | using is_even = metal::number; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = metal::list< 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "metal::number<#{i}>" }.join(', ') %> 14 | >; 15 | 16 | #if defined(METABENCH) 17 | using <%= "result#{k}" %> = metal::partition<<%= "xs#{k}" %>, metal::lambda>; 18 | #endif 19 | 20 | <% end %> 21 | 22 | int main() {} 23 | -------------------------------------------------------------------------------- /benchmark/type/partition/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template 9 | using is_even = mp_bool; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = mp_list< 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "mp_int<#{i}>" }.join(', ') %> 15 | >; 16 | 17 | #if defined(METABENCH) 18 | using <%= "result#{k}" %> = mp_partition<<%= "xs#{k}" %>, is_even>; 19 | #endif 20 | 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/partition/mpl.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_LIST_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | namespace mpl = boost::mpl; 15 | 16 | struct is_even { 17 | template 18 | using apply = mpl::bool_; 19 | }; 20 | 21 | <% env[:k].times do |k| %> 22 | 23 | using <%= "xs#{k}" %> = mpl::list< 24 | <%= ((k*n+1)..(k*n+n)).map { |i| "mpl::int_<#{i}>" }.join(', ') %> 25 | >; 26 | 27 | #if defined(METABENCH) 28 | using <%= "result#{k}" %> = mpl::partition<<%= "xs#{k}" %>, is_even>::type; 29 | #endif 30 | 31 | <% end %> 32 | 33 | int main() {} 34 | -------------------------------------------------------------------------------- /benchmark/type/partition/mpl.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_VECTOR_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | namespace mpl = boost::mpl; 15 | 16 | struct is_even { 17 | template 18 | using apply = mpl::bool_; 19 | }; 20 | 21 | <% env[:k].times do |k| %> 22 | 23 | using <%= "xs#{k}" %> = mpl::vector< 24 | <%= ((k*n+1)..(k*n+n)).map { |i| "mpl::int_<#{i}>" }.join(', ') %> 25 | >; 26 | 27 | #if defined(METABENCH) 28 | using <%= "result#{k}" %> = mpl::partition<<%= "xs#{k}" %>, is_even>::type; 29 | #endif 30 | 31 | <% end %> 32 | 33 | int main() {} 34 | -------------------------------------------------------------------------------- /benchmark/type/replace_if/brigand.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #define BRIGAND_NO_BOOST_SUPPORT 6 | #include 7 | 8 | template 9 | using is_even = brigand::bool_; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = brigand::list< 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "brigand::int32_t<#{i}>" }.join(', ') %> 15 | >; 16 | 17 | #if defined(METABENCH) 18 | using <%= "result#{k}" %> = brigand::replace_if<<%= "xs#{k}" %>, brigand::bind, void>; 19 | #endif 20 | 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/replace_if/hana.types.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | namespace hana = boost::hana; 10 | 11 | struct is_even { 12 | template 13 | hana::bool_ operator()(hana::basic_type> const&) const; 14 | }; 15 | 16 | int main() { 17 | <% env[:k].times do |k| %> 18 | constexpr auto <%= "xs#{k}" %> = hana::experimental::types< 19 | <%= ((k*n+1)..(k*n+n)).map { |i| "hana::int_<#{i}>" }.join(', ') %> 20 | >{}; 21 | 22 | #if defined(METABENCH) 23 | constexpr auto <%= "result#{k}" %> = hana::replace_if(<%= "xs#{k}" %>, is_even{}, hana::type{}); 24 | #endif 25 | <% end %> 26 | } 27 | -------------------------------------------------------------------------------- /benchmark/type/replace_if/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | template 9 | using is_even = mpl::int_; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = mpl::list< 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "mpl::int_<#{i}>" }.join(', ') %> 15 | >; 16 | 17 | #if defined(METABENCH) 18 | using <%= "result#{k}" %> = mpl::eager::replace_if<<%= "xs#{k}" %>, void, is_even>; 19 | #endif 20 | 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/replace_if/meta.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | struct is_even { 8 | template 9 | using invoke = meta::bool_; 10 | }; 11 | 12 | <% env[:k].times do |k| %> 13 | 14 | using <%= "xs#{k}" %> = meta::list< 15 | <%= ((k*n+1)..(k*n+n)).map { |i| "meta::int_<#{i}>" }.join(', ') %> 16 | >; 17 | 18 | #if defined(METABENCH) 19 | using <%= "result#{k}" %> = meta::replace_if<<%= "xs#{k}" %>, is_even, void>; 20 | #endif 21 | 22 | <% end %> 23 | 24 | int main() {} 25 | -------------------------------------------------------------------------------- /benchmark/type/replace_if/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template 8 | using is_even = metal::number; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = metal::list< 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "metal::number<#{i}>" }.join(', ') %> 14 | >; 15 | 16 | #if defined(METABENCH) 17 | using <%= "result#{k}" %> = metal::replace_if<<%= "xs#{k}" %>, metal::lambda, void>; 18 | #endif 19 | 20 | <% end %> 21 | 22 | int main() {} 23 | -------------------------------------------------------------------------------- /benchmark/type/replace_if/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template 9 | using is_even = mp_bool; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = mp_list< 14 | <%= ((k*n+1)..(k*n+n)).map { |i| "mp_int<#{i}>" }.join(', ') %> 15 | >; 16 | 17 | #if defined(METABENCH) 18 | using <%= "result#{k}" %> = mp_replace_if<<%= "xs#{k}" %>, is_even, void>; 19 | #endif 20 | 21 | <% end %> 22 | 23 | int main() {} 24 | -------------------------------------------------------------------------------- /benchmark/type/replace_if/mpl.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_LIST_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | namespace mpl = boost::mpl; 15 | 16 | struct is_even { 17 | template 18 | using apply = mpl::bool_; 19 | }; 20 | 21 | <% env[:k].times do |k| %> 22 | 23 | using <%= "xs#{k}" %> = mpl::list< 24 | <%= ((k*n+1)..(k*n+n)).map { |i| "mpl::int_<#{i}>" }.join(', ') %> 25 | >; 26 | 27 | #if defined(METABENCH) 28 | using <%= "result#{k}" %> = mpl::replace_if<<%= "xs#{k}" %>, is_even, void>::type; 29 | #endif 30 | 31 | <% end %> 32 | 33 | int main() {} 34 | -------------------------------------------------------------------------------- /benchmark/type/replace_if/mpl.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_VECTOR_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | namespace mpl = boost::mpl; 15 | 16 | struct is_even { 17 | template 18 | using apply = mpl::bool_; 19 | }; 20 | 21 | <% env[:k].times do |k| %> 22 | 23 | using <%= "xs#{k}" %> = mpl::vector< 24 | <%= ((k*n+1)..(k*n+n)).map { |i| "mpl::int_<#{i}>" }.join(', ') %> 25 | >; 26 | 27 | #if defined(METABENCH) 28 | using <%= "result#{k}" %> = mpl::replace_if<<%= "xs#{k}" %>, is_even, void>::type; 29 | #endif 30 | 31 | <% end %> 32 | 33 | int main() {} 34 | -------------------------------------------------------------------------------- /benchmark/type/reverse/brigand.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #define BRIGAND_NO_BOOST_SUPPORT 6 | #include 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = brigand::list< 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 14 | >; 15 | 16 | #if defined(METABENCH) 17 | using <%= "result#{k}" %> = brigand::reverse<<%= "xs#{k}" %>>; 18 | #endif 19 | 20 | <% end %> 21 | 22 | int main() {} 23 | -------------------------------------------------------------------------------- /benchmark/type/reverse/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = mpl::list< 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 14 | >; 15 | 16 | #if defined(METABENCH) 17 | using <%= "result#{k}" %> = mpl::eager::reverse<<%= "xs#{k}" %>>; 18 | #endif 19 | 20 | <% end %> 21 | 22 | int main() {} 23 | -------------------------------------------------------------------------------- /benchmark/type/reverse/meta.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template struct x; 8 | 9 | <% env[:k].times do |k| %> 10 | 11 | using <%= "xs#{k}" %> = meta::list< 12 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 13 | >; 14 | 15 | #if defined(METABENCH) 16 | using <%= "result#{k}" %> = meta::reverse<<%= "xs#{k}" %>>; 17 | #endif 18 | 19 | <% end %> 20 | 21 | int main() {} 22 | -------------------------------------------------------------------------------- /benchmark/type/reverse/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template struct x; 8 | 9 | <% env[:k].times do |k| %> 10 | 11 | using <%= "xs#{k}" %> = metal::list< 12 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 13 | >; 14 | 15 | #if defined(METABENCH) 16 | using <%= "result#{k}" %> = metal::reverse<<%= "xs#{k}" %>>; 17 | #endif 18 | 19 | <% end %> 20 | 21 | int main() {} 22 | -------------------------------------------------------------------------------- /benchmark/type/reverse/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = mp_list< 13 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 14 | >; 15 | 16 | #if defined(METABENCH) 17 | using <%= "result#{k}" %> = mp_reverse<<%= "xs#{k}" %>>; 18 | #endif 19 | 20 | <% end %> 21 | 22 | int main() {} 23 | -------------------------------------------------------------------------------- /benchmark/type/reverse/mpl.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_LIST_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | namespace mpl = boost::mpl; 13 | 14 | template struct x; 15 | 16 | <% env[:k].times do |k| %> 17 | 18 | using <%= "xs#{k}" %> = mpl::list< 19 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 20 | >; 21 | 22 | #if defined(METABENCH) 23 | using <%= "result#{k}" %> = mpl::reverse<<%= "xs#{k}" %>>::type; 24 | #endif 25 | 26 | <% end %> 27 | 28 | int main() {} 29 | -------------------------------------------------------------------------------- /benchmark/type/reverse/mpl.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_VECTOR_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | namespace mpl = boost::mpl; 13 | 14 | template struct x; 15 | 16 | <% env[:k].times do |k| %> 17 | 18 | using <%= "xs#{k}" %> = mpl::vector< 19 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 20 | >; 21 | 22 | #if defined(METABENCH) 23 | using <%= "result#{k}" %> = mpl::reverse<<%= "xs#{k}" %>>::type; 24 | #endif 25 | 26 | <% end %> 27 | 28 | int main() {} 29 | -------------------------------------------------------------------------------- /benchmark/type/sort/brigand.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #define BRIGAND_NO_BOOST_SUPPORT 6 | #include 7 | 8 | <% env[:k].times do |k| %> 9 | 10 | using <%= "xs#{k}" %> = brigand::list<<%= 11 | xs = ((k*n+1)..(k*n+n)).map { |i| "brigand::int32_t<#{i}>" } 12 | rng = Random.new(k) 13 | xs.shuffle(random: rng).join(', ') 14 | %>>; 15 | 16 | #if defined(METABENCH) 17 | using <%= "result#{k}" %> = brigand::sort<<%= "xs#{k}" %>>; 18 | #endif 19 | 20 | <% end %> 21 | 22 | int main() { } 23 | -------------------------------------------------------------------------------- /benchmark/type/sort/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | template 9 | using less = mpl::bool_<(T::value < U::value)>; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = mpl::list<<%= 14 | xs = ((k*n+1)..(k*n+n)).map { |i| "mpl::int_<#{i}>" } 15 | rng = Random.new(k) 16 | xs.shuffle(random: rng).join(', ') 17 | %>>; 18 | 19 | #if defined(METABENCH) 20 | using <%= "result#{k}" %> = mpl::eager::stable_sort<<%= "xs#{k}" %>,less>; 21 | #endif 22 | 23 | <% end %> 24 | 25 | int main() { } 26 | -------------------------------------------------------------------------------- /benchmark/type/sort/meta.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | <% env[:k].times do |k| %> 8 | 9 | using <%= "xs#{k}" %> = meta::list<<%= 10 | xs = ((k*n+1)..(k*n+n)).map { |i| "meta::int_<#{i}>" } 11 | rng = Random.new(k) 12 | xs.shuffle(random: rng).join(', ') 13 | %>>; 14 | 15 | #if defined(METABENCH) 16 | using <%= "result#{k}" %> = meta::sort<<%= "xs#{k}" %>, meta::quote>; 17 | #endif 18 | 19 | <% end %> 20 | 21 | int main() { } 22 | -------------------------------------------------------------------------------- /benchmark/type/sort/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | <% env[:k].times do |k| %> 8 | 9 | using <%= "xs#{k}" %> = metal::list<<%= 10 | xs = ((k*n+1)..(k*n+n)).map { |i| "metal::number<#{i}>" } 11 | rng = Random.new(k) 12 | xs.shuffle(random: rng).join(', ') 13 | %>>; 14 | 15 | #if defined(METABENCH) 16 | using <%= "result#{k}" %> = metal::sort<<%= "xs#{k}" %>, metal::lambda>; 17 | #endif 18 | 19 | <% end %> 20 | 21 | int main() { } 22 | -------------------------------------------------------------------------------- /benchmark/type/sort/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template 9 | using less = mp_bool<(M::type::value < N::type::value)>; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = mp_list<<%= 14 | xs = ((k*n+1)..(k*n+n)).map { |i| "mp_int<#{i}>" } 15 | rng = Random.new(k) 16 | xs.shuffle(random: rng).join(', ') 17 | %>>; 18 | 19 | #if defined(METABENCH) 20 | using <%= "result#{k}" %> = mp_sort<<%= "xs#{k}" %>, less>; 21 | #endif 22 | 23 | <% end %> 24 | 25 | int main() { } 26 | -------------------------------------------------------------------------------- /benchmark/type/sort/mpl.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_LIST_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | namespace mpl = boost::mpl; 15 | 16 | <% env[:k].times do |k| %> 17 | 18 | using <%= "xs#{k}" %> = mpl::list<<%= 19 | xs = ((k*n+1)..(k*n+n)).map { |i| "mpl::int_<#{i}>" } 20 | rng = Random.new(k) 21 | xs.shuffle(random: rng).join(', ') 22 | %>>; 23 | 24 | #if defined(METABENCH) 25 | using <%= "result#{k}" %> = mpl::sort<<%= "xs#{k}" %>>::type; 26 | #endif 27 | 28 | <% end %> 29 | 30 | int main() { } 31 | -------------------------------------------------------------------------------- /benchmark/type/sort/mpl.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_VECTOR_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | namespace mpl = boost::mpl; 15 | 16 | <% env[:k].times do |k| %> 17 | 18 | using <%= "xs#{k}" %> = mpl::vector<<%= 19 | xs = ((k*n+1)..(k*n+n)).map { |i| "mpl::int_<#{i}>" } 20 | rng = Random.new(k) 21 | xs.shuffle(random: rng).join(', ') 22 | %>>; 23 | 24 | #if defined(METABENCH) 25 | using <%= "result#{k}" %> = mpl::sort<<%= "xs#{k}" %>>::type; 26 | #endif 27 | 28 | <% end %> 29 | 30 | int main() { } 31 | -------------------------------------------------------------------------------- /benchmark/type/take/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Bruno Dutra 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | set(datasets) 6 | add_dataset(datasets type take brigand list brigand.list.cpp.erb 100 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 7 | add_dataset(datasets type take kvasir list kvasir.list.cpp.erb 100 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 8 | add_dataset(datasets type take metal list metal.list.cpp.erb 100 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 9 | add_dataset(datasets type take mp11 list mp11.list.cpp.erb 25 "[1] + (10..50).step(10).to_a + (100..500).step(50).to_a") 10 | 11 | add_chart(type take DATASETS ${datasets}) 12 | -------------------------------------------------------------------------------- /benchmark/type/take/brigand.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | template struct x; 10 | 11 | <% env[:k].times do |k| %> 12 | 13 | using <%= "xs#{k}" %> = brigand::list<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 14 | 15 | #if defined(METABENCH) 16 | using <%= "result#{k}" %> = brigand::pop_back<<%= "xs#{k}" %>, brigand::int32_t<<%= k*n/env[:k] %>>>; 17 | #endif 18 | 19 | <% end %> 20 | 21 | int main() {} 22 | -------------------------------------------------------------------------------- /benchmark/type/take/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = mpl::list<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 13 | 14 | #if defined(METABENCH) 15 | using <%= "result#{k}" %> = mpl::eager::take<<%= "xs#{k}" %>, <%= k*n/env[:k] %>>; 16 | #endif 17 | <% end %> 18 | 19 | int main() {} 20 | -------------------------------------------------------------------------------- /benchmark/type/take/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template struct x; 8 | 9 | <% env[:k].times do |k| %> 10 | 11 | using <%= "xs#{k}" %> = metal::list<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 12 | 13 | #if defined(METABENCH) 14 | using <%= "result#{k}" %> = metal::take<<%= "xs#{k}" %>, metal::number<<%= k*n/env[:k] %>>>; 15 | #endif 16 | <% end %> 17 | 18 | int main() {} 19 | -------------------------------------------------------------------------------- /benchmark/type/take/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template struct x; 9 | 10 | <% env[:k].times do |k| %> 11 | 12 | using <%= "xs#{k}" %> = mp_list<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 13 | 14 | #if defined(METABENCH) 15 | using <%= "result#{k}" %> = mp_take_c<<%= "xs#{k}" %>, <%= k*n/env[:k] %>>; 16 | #endif 17 | <% end %> 18 | 19 | int main() {} 20 | -------------------------------------------------------------------------------- /benchmark/type/transform/brigand.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #define BRIGAND_NO_BOOST_SUPPORT 6 | #include 7 | 8 | template 9 | using f = X; 10 | 11 | template struct x; 12 | 13 | <% env[:k].times do |k| %> 14 | 15 | using <%= "xs#{k}" %> = brigand::list< 16 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 17 | >; 18 | 19 | #if defined(METABENCH) 20 | using <%= "result#{k}" %> = brigand::transform<<%= "xs#{k}" %>, brigand::bind>; 21 | #endif 22 | 23 | <% end %> 24 | 25 | int main() {} 26 | -------------------------------------------------------------------------------- /benchmark/type/transform/hana.types.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | namespace hana = boost::hana; 9 | 10 | template 11 | struct f { 12 | struct type; 13 | }; 14 | 15 | template struct x; 16 | 17 | int main() { 18 | <% env[:k].times do |k| %> 19 | constexpr auto <%= "xs#{k}" %> = hana::experimental::types< 20 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 21 | >{}; 22 | 23 | #if defined(METABENCH) 24 | constexpr auto <%= "result#{k}" %> = hana::transform(<%= "xs#{k}" %>, hana::metafunction); 25 | #endif 26 | <% end %> 27 | } 28 | -------------------------------------------------------------------------------- /benchmark/type/transform/kvasir.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Odin Holmes 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | namespace mpl = kvasir::mpl; 7 | 8 | template 9 | using f = X; 10 | 11 | template struct x; 12 | 13 | <% env[:k].times do |k| %> 14 | 15 | using <%= "xs#{k}" %> = mpl::list< 16 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 17 | >; 18 | 19 | #if defined(METABENCH) 20 | using <%= "result#{k}" %> = mpl::eager::transform<<%= "xs#{k}" %>,f>; 21 | #endif 22 | 23 | <% end %> 24 | 25 | int main() {} 26 | -------------------------------------------------------------------------------- /benchmark/type/transform/meta.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | struct f { 8 | template 9 | using invoke = X; 10 | }; 11 | 12 | template struct x; 13 | 14 | <% env[:k].times do |k| %> 15 | 16 | using <%= "xs#{k}" %> = meta::list< 17 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 18 | >; 19 | 20 | #if defined(METABENCH) 21 | using <%= "result#{k}" %> = meta::transform<<%= "xs#{k}" %>, f>; 22 | #endif 23 | 24 | <% end %> 25 | 26 | int main() {} 27 | -------------------------------------------------------------------------------- /benchmark/type/transform/metal.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | template 8 | using f = X; 9 | 10 | template struct x; 11 | 12 | <% env[:k].times do |k| %> 13 | 14 | using <%= "xs#{k}" %> = metal::list< 15 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 16 | >; 17 | 18 | #if defined(METABENCH) 19 | using <%= "result#{k}" %> = metal::transform, <%= "xs#{k}" %>>; 20 | #endif 21 | 22 | <% end %> 23 | 24 | int main() {} 25 | -------------------------------------------------------------------------------- /benchmark/type/transform/mp11.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Bruno Dutra 2016 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | using namespace boost::mp11; 7 | 8 | template 9 | using f = X; 10 | 11 | template struct x; 12 | 13 | <% env[:k].times do |k| %> 14 | 15 | using <%= "xs#{k}" %> = mp_list< 16 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 17 | >; 18 | 19 | #if defined(METABENCH) 20 | using <%= "result#{k}" %> = mp_transform>; 21 | #endif 22 | 23 | <% end %> 24 | 25 | int main() {} 26 | -------------------------------------------------------------------------------- /benchmark/type/transform/mpl.list.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_LIST_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | namespace mpl = boost::mpl; 13 | 14 | struct f { 15 | template 16 | struct apply { 17 | using type = X; 18 | }; 19 | }; 20 | 21 | template struct x; 22 | 23 | <% env[:k].times do |k| %> 24 | 25 | using <%= "xs#{k}" %> = mpl::list< 26 | <%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %> 27 | >; 28 | 29 | #if defined(METABENCH) 30 | using <%= "result#{k}" %> = mpl::transform<<%= "xs#{k}" %>, f>::type; 31 | #endif 32 | 33 | <% end %> 34 | 35 | int main() {} 36 | -------------------------------------------------------------------------------- /benchmark/type/transform/mpl.vector.cpp.erb: -------------------------------------------------------------------------------- 1 | // Copyright Louis Dionne 2017 2 | // Distributed under the Boost Software License, Version 1.0. 3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | <% if n > 20 %> 6 | #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS 7 | #define BOOST_MPL_LIMIT_VECTOR_SIZE <%= ((n + 9) / 10) * 10 %> 8 | <% end %> 9 | 10 | #include 11 | #include 12 | namespace mpl = boost::mpl; 13 | 14 | struct f { 15 | template 16 | struct apply { 17 | using type = X; 18 | }; 19 | }; 20 | 21 | template struct x; 22 | 23 | <% env[:k].times do |k| %> 24 | 25 | using <%= "xs#{k}" %> = mpl::vector<<%= ((k*n+1)..(k*n+n)).map { |i| "x<#{i}>" }.join(', ') %>>; 26 | 27 | #if defined(METABENCH) 28 | using <%= "result#{k}" %> = mpl::transform<<%= "xs#{k}" %>, f>::type; 29 | #endif 30 | 31 | <% end %> 32 | 33 | int main() {} 34 | -------------------------------------------------------------------------------- /example/decay/std_decay.cpp.erb: -------------------------------------------------------------------------------- 1 | #include 2 | using std::decay; 3 | 4 | #if defined(METABENCH) 5 | <% (0..n).each do |i| %> 6 | struct T<%= i %> { }; 7 | typedef decay>::type foo1_<%= i %>; 8 | typedef decay&>::type foo2_<%= i %>; 9 | typedef decay&&>::type foo3_<%= i %>; 10 | typedef decay const>::type foo4_<%= i %>; 11 | typedef decay volatile>::type foo5_<%= i %>; 12 | typedef decay [3]>::type foo6_<%= i %>; 13 | <% end %> 14 | #endif 15 | 16 | int main() { } 17 | -------------------------------------------------------------------------------- /example/make_tuple/recursive_tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | template 6 | struct tuple; 7 | 8 | template <> 9 | struct tuple<> { }; 10 | 11 | template 12 | struct tuple { 13 | T value; 14 | tuple rest_; 15 | 16 | explicit tuple(T const& t, Ts const& ...ts) 17 | : value{t}, rest_{ts...} 18 | { } 19 | }; 20 | 21 | template 22 | tuple::type...> make_tuple(T&& ...t) { 23 | return tuple::type...>{std::forward(t)...}; 24 | } 25 | 26 | int main() { 27 | #if defined(METABENCH) 28 | auto tuple = make_tuple(<%= (1..n).to_a.join(', ') %>); 29 | #endif 30 | } 31 | -------------------------------------------------------------------------------- /example/make_tuple/std_tuple.cpp.erb: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | int main() { 5 | #if defined(METABENCH) 6 | auto tuple = std::make_tuple(<%= (1..n).to_a.join(', ') %>); 7 | #endif 8 | } 9 | -------------------------------------------------------------------------------- /test/add_chart_all_target/a_template_file_with_a_very_unique_name.cpp.erb: -------------------------------------------------------------------------------- 1 | int main() { } 2 | -------------------------------------------------------------------------------- /test/add_chart_aspect_link_time/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | # This test makes sure that using the LINK_TIME aspect with metabench_add_chart 6 | # produces a graph of the link time. The test does not actually check anything; 7 | # this must be done by manual inspection. 8 | 9 | cmake_minimum_required(VERSION 3.1) 10 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..") 11 | include(metabench) 12 | 13 | metabench_add_dataset(dummy "dummy.cpp.erb" "[1, 2, 3]") 14 | metabench_add_chart(check ASPECT LINK_TIME DATASETS dummy) 15 | -------------------------------------------------------------------------------- /test/add_chart_aspect_link_time/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | template 2 | struct expr { 3 | Left left; Right right; 4 | void operator()() const { 5 | left(); right(); 6 | } 7 | }; 8 | 9 | template 10 | expr operator+(Left const& left, Right const& right) { 11 | return {left, right}; 12 | } 13 | 14 | template 15 | struct Leaf { 16 | void operator()() const { } 17 | }; 18 | 19 | int main() { 20 | Leaf<1> a; 21 | Leaf<2> b; 22 | 23 | (((a + b) + (a + b)) + ((a + b) + (a + b)) + 24 | ((a + b) + (a + b)) + ((a + b) + (a + b)))(); 25 | } 26 | -------------------------------------------------------------------------------- /test/add_chart_aspect_peak_memory/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2016 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | # This test makes sure that using the PEAK_MEMORY aspect with metabench_add_chart 6 | # produces a graph of the peak memory usage. The test does not actually check 7 | # anything; this must be done by manual inspection. Since we compile the same 8 | # code several times over, the peak memory usage should be consistent. 9 | 10 | cmake_minimum_required(VERSION 3.1) 11 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..") 12 | include(metabench) 13 | 14 | metabench_add_dataset(dummy "dummy.cpp.erb" "[1, 2, 3, 4, 5]") 15 | metabench_add_chart(check ASPECT PEAK_MEMORY DATASETS dummy) 16 | -------------------------------------------------------------------------------- /test/add_chart_aspect_peak_memory/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | template 2 | struct expr { 3 | Left left; Right right; 4 | void operator()() const { 5 | left(); right(); 6 | } 7 | }; 8 | 9 | template 10 | expr operator+(Left const& left, Right const& right) { 11 | return {left, right}; 12 | } 13 | 14 | template 15 | struct Leaf { 16 | void operator()() const { } 17 | }; 18 | 19 | int main() { 20 | Leaf<1> a; 21 | Leaf<2> b; 22 | 23 | (((a + b) + (a + b)) + ((a + b) + (a + b)) + 24 | ((a + b) + (a + b)) + ((a + b) + (a + b)))(); 25 | } 26 | -------------------------------------------------------------------------------- /test/add_chart_aspect_size/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | # This test makes sure that using the EXECUTABLE_SIZE aspect with 6 | # metabench_add_chart produces a graph of the executable size. 7 | # The test does not actually check anything; this must be done by 8 | # manual inspection. 9 | 10 | cmake_minimum_required(VERSION 3.1) 11 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..") 12 | include(metabench) 13 | 14 | metabench_add_dataset(dummy "dummy.cpp.erb" "[1, 2, 3]") 15 | metabench_add_chart(check ASPECT EXECUTABLE_SIZE DATASETS dummy) 16 | -------------------------------------------------------------------------------- /test/add_chart_aspect_size/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | int main() { } 2 | -------------------------------------------------------------------------------- /test/add_chart_custom_look/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | # This test makes sure that metabench_add_chart can be used with arguments 6 | # like TITLE, SUBTITLE, XLABEL and YLABEL to customize the look of the chart. 7 | # The test does not actually check anything; this must be done by manual 8 | # inspection. 9 | 10 | cmake_minimum_required(VERSION 3.1) 11 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..") 12 | include(metabench) 13 | 14 | metabench_add_dataset(dummy "dummy.cpp.erb" "[1, 2, 3]") 15 | metabench_add_chart(check 16 | TITLE "my fancy title" 17 | SUBTITLE "my fancy subtitle" 18 | XLABEL "my fancy X label" 19 | YLABEL "my fancy Y label" 20 | DATASETS dummy 21 | ) 22 | -------------------------------------------------------------------------------- /test/add_chart_custom_look/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | int main() { } 2 | -------------------------------------------------------------------------------- /test/add_chart_custom_output/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | int main() { } 2 | -------------------------------------------------------------------------------- /test/add_chart_custom_output_absolute/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | # Same as the `add_chart_custom_output` test, but with an absolute OUTPUT. 6 | 7 | cmake_minimum_required(VERSION 3.1) 8 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..") 9 | include(metabench) 10 | 11 | metabench_add_dataset(dummy "dummy.cpp.erb" "[1, 2, 3]") 12 | metabench_add_chart(check DATASETS dummy OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/my/fancy/output.html) 13 | 14 | enable_testing() 15 | 16 | add_test(NAME generate_chart 17 | COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} --target check) 18 | 19 | add_test(NAME check_generated_chart 20 | COMMAND ${RUBY_EXECUTABLE} 21 | -e "html = '${CMAKE_CURRENT_BINARY_DIR}/my/fancy/output.html'" 22 | -e "raise \"file #{html} is missing\" if !File.exist?(html)" 23 | ) 24 | 25 | set_tests_properties(check_generated_chart PROPERTIES DEPENDS generate_chart) 26 | -------------------------------------------------------------------------------- /test/add_chart_custom_output_absolute/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | int main() { } 2 | -------------------------------------------------------------------------------- /test/add_chart_default_output/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | int main() { } 2 | -------------------------------------------------------------------------------- /test/add_dataset_absolute_erb/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | # This test makes sure that we can use an absolute path to specify the ERB 6 | # template in `metabench_add_dataset`. 7 | 8 | cmake_minimum_required(VERSION 3.1) 9 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..") 10 | include(metabench) 11 | 12 | metabench_add_dataset(dummy "${CMAKE_CURRENT_SOURCE_DIR}/dummy.cpp.erb" "[1, 2, 3]") 13 | metabench_add_chart(check DATASETS dummy) 14 | -------------------------------------------------------------------------------- /test/add_dataset_absolute_erb/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | int main() { } 2 | -------------------------------------------------------------------------------- /test/add_dataset_ctest_target/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | # This test makes sure that metabench_add_dataset sets up a Ctest target for 6 | # testing the benchmark when testing is enabled. 7 | 8 | cmake_minimum_required(VERSION 3.1) 9 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..") 10 | 11 | enable_testing() 12 | include(metabench) 13 | 14 | metabench_add_dataset(dummy dummy.cpp.erb "[1, 2, 3]") 15 | metabench_add_chart(check DATASETS dummy) 16 | -------------------------------------------------------------------------------- /test/add_dataset_ctest_target/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | int main() { } 2 | -------------------------------------------------------------------------------- /test/add_dataset_custom_output/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | int main() { } 2 | -------------------------------------------------------------------------------- /test/add_dataset_custom_output_absolute/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | int main() { } 2 | -------------------------------------------------------------------------------- /test/add_dataset_custom_properties/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | # This test makes sure that we can set properties on individual dataset targets. 6 | # The test also makes sure that the properties are not leaked across targets. 7 | 8 | cmake_minimum_required(VERSION 3.1) 9 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..") 10 | include(metabench) 11 | 12 | metabench_add_dataset(dummy1 dummy1.cpp.erb "[1, 2, 3]") 13 | metabench_add_dataset(dummy2 dummy2.cpp.erb "[1, 2, 3]") 14 | metabench_add_chart(check DATASETS dummy1 dummy2) 15 | 16 | target_compile_definitions(dummy1 PUBLIC -DCUSTOM_DEFINITION_DUMMY1=1234) 17 | target_compile_definitions(dummy2 PUBLIC -DCUSTOM_DEFINITION_DUMMY2=5678) 18 | -------------------------------------------------------------------------------- /test/add_dataset_custom_properties/dummy1.cpp.erb: -------------------------------------------------------------------------------- 1 | 2 | #if !defined(CUSTOM_DEFINITION_DUMMY1) || CUSTOM_DEFINITION_DUMMY1 != 1234 3 | # error "CUSTOM_DEFINITION_DUMMY1 should be defined to be 1234" 4 | #endif 5 | 6 | #if defined(CUSTOM_DEFINITION_DUMMY2) 7 | # error "CUSTOM_DEFINITION_DUMMY2 should not be defined here" 8 | #endif 9 | 10 | int main() { } 11 | -------------------------------------------------------------------------------- /test/add_dataset_custom_properties/dummy2.cpp.erb: -------------------------------------------------------------------------------- 1 | 2 | #if !defined(CUSTOM_DEFINITION_DUMMY2) || CUSTOM_DEFINITION_DUMMY2 != 5678 3 | # error "CUSTOM_DEFINITION_DUMMY2 should be defined to be 5678" 4 | #endif 5 | 6 | #if defined(CUSTOM_DEFINITION_DUMMY1) 7 | # error "CUSTOM_DEFINITION_DUMMY1 should not be defined here" 8 | #endif 9 | 10 | int main() { } 11 | -------------------------------------------------------------------------------- /test/add_dataset_default_output/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | int main() { } 2 | -------------------------------------------------------------------------------- /test/add_dataset_generate_with_custom_rule/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | # This test makes sure that we can trigger the generation of a dataset from a 6 | # custom target by making the custom target dependent on the JSON file of the 7 | # dataset. 8 | 9 | cmake_minimum_required(VERSION 3.1) 10 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..") 11 | include(metabench) 12 | 13 | 14 | metabench_add_dataset(dummy dummy.cpp.erb "[1, 2, 3]") 15 | add_custom_target(check 16 | COMMAND ${RUBY_EXECUTABLE} 17 | -e "json = '${CMAKE_CURRENT_BINARY_DIR}/dummy.json'" 18 | -e "raise \"file #{json} is missing\" if !File.exist?(json)" 19 | DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dummy.json 20 | VERBATIM 21 | ) 22 | -------------------------------------------------------------------------------- /test/add_dataset_generate_with_custom_rule/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | int main() { } 2 | -------------------------------------------------------------------------------- /test/add_dataset_median_of/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | 2 | int main() { } 3 | -------------------------------------------------------------------------------- /test/add_dataset_nested_directories/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | # This test makes sure that we can add a dataset in a nested directory, 6 | # i.e. that the call to `metabench_add_dataset` does not need to be in 7 | # the same directory or a direct parent of the ERB file we're adding. 8 | 9 | cmake_minimum_required(VERSION 3.1) 10 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..") 11 | include(metabench) 12 | 13 | metabench_add_dataset(dummy path/to/benchmark/dummy.cpp.erb "[1, 2, 3]") 14 | metabench_add_chart(check DATASETS dummy) 15 | -------------------------------------------------------------------------------- /test/add_dataset_nested_directories/path/to/benchmark/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | int main() { } 2 | -------------------------------------------------------------------------------- /test/dataset_and_template_differ/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | # This test makes sure that the name of the dataset target can differ from the 6 | # basename of the template file associated to it. 7 | 8 | cmake_minimum_required(VERSION 3.1) 9 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..") 10 | include(metabench) 11 | 12 | metabench_add_dataset(dummy_target dummy.cpp.erb "[1, 2, 3]") 13 | metabench_add_chart(check DATASETS dummy_target) 14 | -------------------------------------------------------------------------------- /test/dataset_and_template_differ/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | 2 | int main() { } 3 | -------------------------------------------------------------------------------- /test/dataset_properties_on_ctest_targets/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | # This test makes sure that properties set on a dataset target are 6 | # also set for the corresponding CTest target created by Metabench. 7 | 8 | cmake_minimum_required(VERSION 3.1) 9 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..") 10 | include(metabench) 11 | 12 | enable_testing() 13 | metabench_add_dataset(dummy dummy.cpp.erb "[1, 2, 3]") 14 | metabench_add_chart(check DATASETS dummy) 15 | 16 | target_compile_definitions(dummy PUBLIC -DCUSTOM_DEFINITION) 17 | -------------------------------------------------------------------------------- /test/dataset_properties_on_ctest_targets/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | 2 | #if !defined(CUSTOM_DEFINITION) 3 | # error "CUSTOM_DEFINITION should be defined here" 4 | #endif 5 | 6 | int main() { } 7 | -------------------------------------------------------------------------------- /test/env/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2016 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | # This test makes sure that we can pass information to the .cpp.erb files via 6 | # the `env` variable. 7 | 8 | cmake_minimum_required(VERSION 3.1) 9 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..") 10 | include(metabench) 11 | 12 | metabench_add_dataset(dummy dummy.cpp.erb "[1, 2, 3]" ENV "{variable: 123}") 13 | metabench_add_chart(check DATASETS dummy) 14 | -------------------------------------------------------------------------------- /test/env/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | // trigger a compilation error if env[:variable] is not equal to 123 2 | char c[<%= env[:variable] %> == 123 ? 10 : 0]; 3 | 4 | int main() { } 5 | -------------------------------------------------------------------------------- /test/local_header/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | # This test makes sure that we can #include a local header from the .cpp files. 6 | 7 | cmake_minimum_required(VERSION 3.1) 8 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..") 9 | include(metabench) 10 | 11 | metabench_add_dataset(dummy dummy.cpp.erb "[1, 2, 3]") 12 | metabench_add_chart(check DATASETS dummy) 13 | -------------------------------------------------------------------------------- /test/local_header/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | #include "local_header.hpp" 2 | 3 | int main() { } 4 | -------------------------------------------------------------------------------- /test/local_header/local_header.hpp: -------------------------------------------------------------------------------- 1 | // Local header included by `dummy.cpp.erb` 2 | -------------------------------------------------------------------------------- /test/n/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | # This test makes sure that the 'n' variable is used to pass the value of the 6 | # current iteration to the '.cpp' files. 7 | 8 | cmake_minimum_required(VERSION 3.1) 9 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..") 10 | include(metabench) 11 | 12 | metabench_add_dataset(dummy dummy.cpp.erb "[1, 2, 3, 4]") 13 | metabench_add_chart(check DATASETS dummy) 14 | 15 | -------------------------------------------------------------------------------- /test/n/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | 2 | <% raise "something is wrong" if not [0, 1, 2, 3, 4].include? n %> 3 | 4 | int main() { } 5 | -------------------------------------------------------------------------------- /test/one_template_many_datasets/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | # This test makes sure that we can use the same template to create different 6 | # datasets. Thus, we can't use the name of the template to differentiate 7 | # between datasets; we really must use the name of the dataset target. 8 | 9 | cmake_minimum_required(VERSION 3.1) 10 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..") 11 | include(metabench) 12 | 13 | metabench_add_dataset(dummy1 dummy.cpp.erb "[0, 1, 2]") 14 | target_compile_definitions(dummy1 PUBLIC -DDUMMY1) 15 | 16 | metabench_add_dataset(dummy2 dummy.cpp.erb "[3, 4, 5]") 17 | target_compile_definitions(dummy2 PUBLIC -DDUMMY2) 18 | 19 | metabench_add_chart(check DATASETS dummy1 dummy2) 20 | -------------------------------------------------------------------------------- /test/one_template_many_datasets/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | 2 | #if defined(DUMMY1) && <%= ([0, 1, 2].include? n) ? 0 : 1 %> 3 | # error "DUMMY1: something is wrong" 4 | #endif 5 | 6 | #if defined(DUMMY2) && <%= ([3, 4, 5].include? n) ? 0 : 1 %> 7 | # error "DUMMY2: something is wrong" 8 | #endif 9 | 10 | int main() { } 11 | -------------------------------------------------------------------------------- /test/path contains spaces/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Bruno Dutra 2016 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | # This test makes sure that we can run from within a directory path that 6 | # contains spaces 7 | 8 | cmake_minimum_required(VERSION 3.1) 9 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..") 10 | include(metabench) 11 | 12 | metabench_add_dataset(dummy dummy.cpp.erb "[1, 2, 3]") 13 | metabench_add_chart(check DATASETS dummy) 14 | -------------------------------------------------------------------------------- /test/path contains spaces/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | int main() { } 2 | -------------------------------------------------------------------------------- /test/should_fail_on_compilation_error/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright Louis Dionne 2017 2 | # Distributed under the Boost Software License, Version 1.0. 3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 4 | 5 | # This test makes sure that the benchmark fails when a compilation error 6 | # happens. 7 | 8 | cmake_minimum_required(VERSION 3.1) 9 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..") 10 | include(metabench) 11 | 12 | add_custom_target(check) # dummy 'check' target run by tools/run_tests.sh 13 | 14 | enable_testing() 15 | metabench_add_dataset(dummy dummy.cpp.erb "[1, 2, 3]") 16 | metabench_add_chart(my_benchmark DATASETS dummy) 17 | set_tests_properties(dummy PROPERTIES WILL_FAIL TRUE) 18 | -------------------------------------------------------------------------------- /test/should_fail_on_compilation_error/dummy.cpp.erb: -------------------------------------------------------------------------------- 1 | #error This should not compile 2 | 3 | int main() { } 4 | -------------------------------------------------------------------------------- /tools/cmake_escape.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright Bruno Dutra 2016 4 | # Distributed under the Boost Software License, Version 1.0. 5 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) 6 | 7 | if [[ $# != 1 ]] 8 | then 9 | echo "Usage:" 10 | echo " $0 " 11 | exit 1 12 | fi 13 | 14 | curl -ILfSs $1 > /dev/null || exit 2 15 | 16 | curl -Ls $1 \ 17 | | perl \ 18 | -pe 's/(.{2048}[^ ,;]+.)/\1\n/g;' \ 19 | -pe 's/\\/\\\\/g;' \ 20 | -pe 's/"/\\"/g;' \ 21 | -pe 's/@/\\@/g;' \ 22 | -pe 's/\n/\\\n/g;' \ 23 | || exit 3 24 | --------------------------------------------------------------------------------