• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
5 <% if input_size > 10 %>
6     #define FUSION_MAX_LIST_SIZE <%= ((input_size + 9) / 10) * 10 %>
7 <% end %>
8 
9 #include <boost/fusion/include/find_if.hpp>
10 #include <boost/fusion/include/make_list.hpp>
11 #include <boost/mpl/integral_c.hpp>
12 namespace fusion = boost::fusion;
13 namespace mpl = boost::mpl;
14 
15 
16 struct is_last {
17     template <typename N>
18     struct apply
19         : mpl::integral_c<bool, N::type::value == <%= input_size %>>
20     { };
21 };
22 
23 int main() {
24     auto ints = fusion::make_list(
25         <%= (1..input_size).map { |n| "mpl::integral_c<int, #{n}>{}" }.join(', ') %>
26     );
27 
28     auto result = fusion::find_if<is_last>(ints);
29     (void)result;
30 }
31