tag.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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/ext/std/integral_constant.hpp>
  5. #include <boost/hana/core/tag_of.hpp>
  6. #include <type_traits>
  7. namespace hana = boost::hana;
  8. struct inherit_simple : std::integral_constant<int, 3> { };
  9. struct inherit_no_default : std::integral_constant<int, 3> {
  10. inherit_no_default() = delete;
  11. };
  12. struct incomplete;
  13. struct empty_type { };
  14. struct non_pod { virtual ~non_pod() { } };
  15. static_assert(std::is_same<
  16. hana::tag_of_t<inherit_simple>,
  17. hana::ext::std::integral_constant_tag<int>
  18. >{}, "");
  19. static_assert(std::is_same<
  20. hana::tag_of_t<inherit_no_default>,
  21. hana::ext::std::integral_constant_tag<int>
  22. >{}, "");
  23. static_assert(std::is_same<
  24. hana::tag_of_t<std::is_pointer<int*>>,
  25. hana::ext::std::integral_constant_tag<bool>
  26. >{}, "");
  27. static_assert(!std::is_same<
  28. hana::tag_of_t<incomplete>,
  29. hana::ext::std::integral_constant_tag<int>
  30. >{}, "");
  31. static_assert(!std::is_same<
  32. hana::tag_of_t<empty_type>,
  33. hana::ext::std::integral_constant_tag<int>
  34. >{}, "");
  35. static_assert(!std::is_same<
  36. hana::tag_of_t<non_pod>,
  37. hana::ext::std::integral_constant_tag<int>
  38. >{}, "");
  39. static_assert(!std::is_same<
  40. hana::tag_of_t<void>,
  41. hana::ext::std::integral_constant_tag<int>
  42. >{}, "");
  43. int main() { }