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