]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/benchmark/fold_left/execute.fusion.list.erb.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / hana / benchmark / fold_left / execute.fusion.list.erb.cpp
1 // Copyright Louis Dionne 2013-2016
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 <% if input_size > 10 %>
7 #define FUSION_MAX_LIST_SIZE <%= ((input_size + 9) / 10) * 10 %>
8 <% end %>
9
10 #include <boost/fusion/include/fold.hpp>
11 #include <boost/fusion/include/make_list.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 double 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 result += fusion::fold(values, 0, [](auto state, auto t) {
28 return state + t;
29 });
30 }
31 });
32 }