keys.cpp 912 B

123456789101112131415161718192021222324252627282930
  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/assert.hpp>
  5. #include <boost/hana/contains.hpp>
  6. #include <boost/hana/integral_constant.hpp>
  7. #include <boost/hana/keys.hpp>
  8. #include <boost/hana/map.hpp>
  9. #include <boost/hana/pair.hpp>
  10. #include <boost/hana/permutations.hpp>
  11. #include <boost/hana/tuple.hpp>
  12. #include <boost/hana/type.hpp>
  13. #include <string>
  14. namespace hana = boost::hana;
  15. using namespace std::literals;
  16. int main() {
  17. auto m = hana::make_map(
  18. hana::make_pair(hana::int_c<1>, "foobar"s),
  19. hana::make_pair(hana::type_c<void>, 1234)
  20. );
  21. // The order of the keys is unspecified.
  22. BOOST_HANA_CONSTANT_CHECK(
  23. hana::keys(m) ^hana::in^ hana::permutations(hana::make_tuple(hana::int_c<1>, hana::type_c<void>))
  24. );
  25. }