execute.hana.tuple.erb.cpp 766 B

1234567891011121314151617181920212223242526
  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. #include <boost/hana/transform.hpp>
  5. #include <boost/hana/tuple.hpp>
  6. #include "measure.hpp"
  7. #include <cstdlib>
  8. int main () {
  9. boost::hana::benchmark::measure([] {
  10. long long result = 0;
  11. for (int iteration = 0; iteration < 1 << 10; ++iteration) {
  12. auto values = boost::hana::make_tuple(
  13. <%= input_size.times.map { 'std::rand()' }.join(', ') %>
  14. );
  15. auto transformed = boost::hana::transform(values, [&](auto t) {
  16. return result += t;
  17. });
  18. (void)transformed;
  19. }
  20. });
  21. }