applicative.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031
  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/ap.hpp>
  5. #include <boost/hana/equal.hpp>
  6. #include <boost/hana/ext/std/tuple.hpp>
  7. #include <boost/hana/functional/flip.hpp>
  8. #include <boost/hana/lift.hpp>
  9. #include <boost/hana/pair.hpp>
  10. #include <boost/hana/tuple.hpp>
  11. #include <tuple>
  12. namespace hana = boost::hana;
  13. static_assert(hana::lift<hana::tuple_tag>('x') == hana::make_tuple('x'), "");
  14. static_assert(hana::equal(hana::lift<hana::ext::std::tuple_tag>('x'), std::make_tuple('x')), "");
  15. constexpr auto f = hana::make_pair;
  16. constexpr auto g = hana::flip(hana::make_pair);
  17. static_assert(
  18. hana::ap(hana::make_tuple(f, g), hana::make_tuple(1, 2, 3), hana::make_tuple('a', 'b'))
  19. ==
  20. hana::make_tuple(
  21. f(1, 'a'), f(1, 'b'), f(2, 'a'), f(2, 'b'), f(3, 'a'), f(3, 'b'),
  22. g(1, 'a'), g(1, 'b'), g(2, 'a'), g(2, 'b'), g(3, 'a'), g(3, 'b')
  23. )
  24. , "");
  25. int main() { }