map.cpp 1021 B

123456789101112131415161718192021222324252627282930313233
  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/map.hpp>
  5. #include <laws/base.hpp>
  6. #include <support/minimal_product.hpp>
  7. #include <type_traits>
  8. #include <utility>
  9. namespace hana = boost::hana;
  10. template <typename ...Pairs>
  11. struct check_map {
  12. static_assert(std::is_same<
  13. hana::map<Pairs...>,
  14. decltype(hana::make_map(std::declval<Pairs>()...))
  15. >{}, "");
  16. };
  17. template <int i>
  18. using pair = ::product_t<hana::test::ct_eq<i>, hana::test::ct_eq<-i>>;
  19. template struct check_map<>;
  20. template struct check_map<pair<1>>;
  21. template struct check_map<pair<1>, pair<2>>;
  22. template struct check_map<pair<1>, pair<2>, pair<3>>;
  23. template struct check_map<pair<1>, pair<2>, pair<3>, pair<4>>;
  24. template struct check_map<pair<1>, pair<2>, pair<3>, pair<4>, pair<5>>;
  25. template struct check_map<pair<1>, pair<2>, pair<3>, pair<4>, pair<5>, pair<6>>;
  26. int main() { }