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 #include <boost/hana/bool.hpp> 6 #include <boost/hana/ext/std/integer_sequence.hpp> 7 #include <boost/hana/find_if.hpp> 8 #include <boost/hana/integral_constant.hpp> 9 10 #include <utility> 11 namespace hana = boost::hana; 12 13 14 struct is_last { 15 template <typename N> operator ()is_last16 constexpr auto operator()(N) const { 17 return hana::bool_c<N::value == <%= input_size %>>; 18 } 19 }; 20 main()21int main() { 22 auto sequence = std::integer_sequence< 23 <%= (["int"] + (1..input_size).to_a).join(', ') %> 24 >{}; 25 auto result = hana::find_if(sequence, is_last{}); 26 (void)result; 27 } 28