You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 line
825 B

  1. #pragma once
  2. #include <cpputils/mp/core/modifier.h>
  3. #include <cpputils/mp/misc/when.h>
  4. namespace utl {
  5. namespace mp {
  6. namespace __impl /* forward declaration */
  7. {
  8. template<typename T, typename = void>
  9. struct tag_of_impl;
  10. }
  11. template<typename T>
  12. using tag_of = typename __impl::tag_of_impl<clean_type<T>>::type;
  13. namespace __impl /* implementation */
  14. {
  15. template<typename T, typename>
  16. struct tag_of_impl :
  17. public tag_of_impl<T, when<true>>
  18. { };
  19. template<typename T, bool condition>
  20. struct tag_of_impl<T, when<condition>>
  21. { using type = T; };
  22. template<typename T>
  23. struct tag_of_impl<T, when_valid<typename clean_type<T>::tag>>
  24. { using type = typename clean_type<T>::tag; };
  25. }
  26. }
  27. }