is_scoped_enum.hpp 722 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef BOOST_ENDIAN_DETAIL_IS_SCOPED_ENUM_HPP_INCLUDED
  2. #define BOOST_ENDIAN_DETAIL_IS_SCOPED_ENUM_HPP_INCLUDED
  3. // Copyright 2020 Peter Dimov
  4. //
  5. // Distributed under the Boost Software License, Version 1.0.
  6. // https://www.boost.org/LICENSE_1_0.txt
  7. #include <type_traits>
  8. namespace boost
  9. {
  10. namespace endian
  11. {
  12. namespace detail
  13. {
  14. template<class T> struct negation: std::integral_constant<bool, !T::value> {};
  15. template<class T> struct is_scoped_enum:
  16. std::conditional<
  17. std::is_enum<T>::value,
  18. negation< std::is_convertible<T, int> >,
  19. std::false_type
  20. >::type
  21. {
  22. };
  23. } // namespace detail
  24. } // namespace endian
  25. } // namespace boost
  26. #endif // BOOST_ENDIAN_DETAIL_IS_SCOPED_ENUM_HPP_INCLUDED