enumerators.hpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef BOOST_DESCRIBE_ENUMERATORS_HPP_INCLUDED
  2. #define BOOST_DESCRIBE_ENUMERATORS_HPP_INCLUDED
  3. // Copyright 2020, 2021 Peter Dimov
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // https://www.boost.org/LICENSE_1_0.txt
  6. #include <boost/describe/detail/void_t.hpp>
  7. #include <boost/describe/detail/config.hpp>
  8. #if defined(BOOST_DESCRIBE_CXX11)
  9. #include <type_traits>
  10. namespace boost
  11. {
  12. namespace describe
  13. {
  14. // describe_enumerators<E>
  15. template<class E> using describe_enumerators = decltype( boost_enum_descriptor_fn( static_cast<E**>(0) ) );
  16. // has_describe_enumerators<E>
  17. namespace detail
  18. {
  19. template<class E, class En = void> struct has_describe_enumerators: std::false_type
  20. {
  21. };
  22. template<class E> struct has_describe_enumerators<E, void_t<describe_enumerators<E>>>: std::true_type
  23. {
  24. };
  25. } // namespace detail
  26. template<class E> using has_describe_enumerators = detail::has_describe_enumerators<E>;
  27. } // namespace describe
  28. } // namespace boost
  29. #endif // defined(BOOST_DESCRIBE_CXX11)
  30. #endif // #ifndef BOOST_DESCRIBE_ENUMERATORS_HPP_INCLUDED