move.fusion.vector.erb.cpp 971 B

123456789101112131415161718192021222324252627282930313233
  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. <% if input_size > 10 %>
  5. #define FUSION_MAX_VECTOR_SIZE <%= ((input_size + 9) / 10) * 10 %>
  6. <% end %>
  7. #include <boost/fusion/include/as_vector.hpp>
  8. #include <boost/fusion/include/make_vector.hpp>
  9. #include <boost/fusion/include/reverse.hpp>
  10. #include "measure.hpp"
  11. #include <cstdlib>
  12. #include <string>
  13. #include <utility>
  14. namespace fusion = boost::fusion;
  15. namespace hana = boost::hana;
  16. int main () {
  17. std::string s(1000, 'x');
  18. hana::benchmark::measure([&] {
  19. for (int iteration = 0; iteration < 1 << 5; ++iteration) {
  20. auto values = fusion::make_vector(
  21. <%= input_size.times.map { 's' }.join(', ') %>
  22. );
  23. auto result = fusion::as_vector(fusion::reverse(std::move(values)));
  24. (void)result;
  25. }
  26. });
  27. }