compile.fusion.list.erb.cpp 786 B

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