• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright Louis Dionne 2013-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 input_size > 10 %>
6     #define FUSION_MAX_LIST_SIZE <%= ((input_size + 9) / 10) * 10 %>
7 <% end %>
8 
9 #include <boost/fusion/include/as_list.hpp>
10 #include <boost/fusion/include/make_list.hpp>
11 #include <boost/fusion/include/transform.hpp>
12 
13 #include "measure.hpp"
14 #include <cstdlib>
15 namespace fusion = boost::fusion;
16 namespace hana = boost::hana;
17 
18 
19 int main () {
20     hana::benchmark::measure([] {
21         long long result = 0;
22         for (int iteration = 0; iteration < 1 << 10; ++iteration) {
23             auto values = fusion::make_list(
24                 <%= input_size.times.map { 'std::rand()' }.join(', ') %>
25             );
26 
27             auto transformed = fusion::as_list(fusion::transform(values, [&](auto t) {
28                 return result += t;
29             }));
30             (void)transformed;
31         }
32     });
33 }
34