compile.hana.tuple.erb.cpp 726 B

123456789101112131415161718192021222324
  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. #include <boost/hana/bool.hpp>
  5. #include <boost/hana/find_if.hpp>
  6. #include <boost/hana/integral_constant.hpp>
  7. #include <boost/hana/tuple.hpp>
  8. struct is_last {
  9. template <typename N>
  10. constexpr auto operator()(N) const {
  11. return boost::hana::bool_c<N::value == <%= input_size %>>;
  12. }
  13. };
  14. int main() {
  15. constexpr auto tuple = boost::hana::make_tuple(
  16. <%= (1..input_size).map { |n| "boost::hana::int_c<#{n}>" }.join(', ') %>
  17. );
  18. constexpr auto result = boost::hana::find_if(tuple, is_last{});
  19. (void)result;
  20. }