compile.hana.set.erb.cpp 720 B

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