compile.fusion.vector.erb.cpp 772 B

12345678910111213141516171819202122232425262728293031
  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/fold.hpp>
  8. #include <boost/fusion/include/make_vector.hpp>
  9. namespace fusion = boost::fusion;
  10. struct f {
  11. template <typename State, typename X>
  12. constexpr X operator()(State, X x) const { return x; }
  13. };
  14. struct state { };
  15. template <int i>
  16. struct x { };
  17. int main() {
  18. auto xs = fusion::make_vector(
  19. <%= (1..input_size).map { |n| "x<#{n}>{}" }.join(', ') %>
  20. );
  21. auto result = fusion::fold(xs, state{}, f{});
  22. (void)result;
  23. }