• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright Louis Dionne 2013-2017
2 // Copyright Zach Laine 2014
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
5 
6 #include <boost/hana/fold_left.hpp>
7 #include <boost/hana/tuple.hpp>
8 
9 #include "measure.hpp"
10 #include <cstdlib>
11 
12 
main()13 int main () {
14     boost::hana::benchmark::measure([] {
15         long double result = 0;
16         for (int iteration = 0; iteration < 1 << 10; ++iteration) {
17             auto values = boost::hana::make_tuple(
18                 <%= input_size.times.map { 'std::rand()' }.join(', ') %>
19             );
20 
21             result += boost::hana::fold_left(values, 0, [](auto state, auto t) {
22                 return state + t;
23             });
24         }
25     });
26 }
27