compile.hana.basic_tuple.erb.cpp 677 B

1234567891011121314151617181920212223242526
  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/fold_left.hpp>
  5. #include <boost/hana/basic_tuple.hpp>
  6. namespace hana = boost::hana;
  7. struct f {
  8. template <typename State, typename X>
  9. constexpr X operator()(State, X x) const { return x; }
  10. };
  11. struct state { };
  12. template <int i>
  13. struct x { };
  14. int main() {
  15. constexpr auto tuple = hana::make_basic_tuple(
  16. <%= (1..input_size).map { |n| "x<#{n}>{}" }.join(', ') %>
  17. );
  18. constexpr auto result = hana::fold_left(tuple, state{}, f{});
  19. (void)result;
  20. }