compile.fusion.list.erb.cpp 829 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/find_if.hpp>
  8. #include <boost/fusion/include/make_list.hpp>
  9. #include <boost/mpl/integral_c.hpp>
  10. namespace fusion = boost::fusion;
  11. namespace mpl = boost::mpl;
  12. struct is_last {
  13. template <typename N>
  14. struct apply
  15. : mpl::integral_c<bool, N::type::value == <%= input_size %>>
  16. { };
  17. };
  18. int main() {
  19. auto ints = fusion::make_list(
  20. <%= (1..input_size).map { |n| "mpl::integral_c<int, #{n}>{}" }.join(', ') %>
  21. );
  22. auto result = fusion::find_if<is_last>(ints);
  23. (void)result;
  24. }