tag_of.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright Louis Dionne 2013-2016
  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/core/tag_of.hpp>
  5. #include <boost/hana/ext/std/integral_constant.hpp>
  6. #include <boost/hana/integral_constant.hpp>
  7. #include <boost/hana/pair.hpp>
  8. #include <type_traits>
  9. namespace hana = boost::hana;
  10. int main() {
  11. {
  12. struct T { }; struct U { };
  13. static_assert(std::is_same<
  14. hana::tag_of<hana::pair<T, U>>::type,
  15. hana::pair_tag
  16. >{}, "");
  17. }
  18. // Bug #1
  19. {
  20. using Pair = hana::pair<hana::integral_constant<int, 3>, int>;
  21. using PairTag = hana::tag_of<Pair>::type;
  22. using Tag = hana::tag_of<std::integral_constant<unsigned long, 0>>::type;
  23. }
  24. // Bug #2
  25. {
  26. using Pair = hana::pair<std::integral_constant<int, 3>, int>;
  27. using PairTag = hana::tag_of<Pair>::type;
  28. using Tag = hana::tag_of<std::integral_constant<unsigned long, 0>>::type;
  29. }
  30. }