Глядя на http://www.boost.org/doc/libs/1_44_0/boost/type_traits/is_enum.hpp,
Если это значение равно true
:
::boost::type_traits::ice_or<
::boost::is_arithmetic<T>::value
, ::boost::is_reference<T>::value
, ::boost::is_function<T>::value
, is_class_or_union<T>::value
, is_array<T>::value
>::value
Затем выбирается этот базовый шаблон:
// Don't evaluate convertibility to int_convertible unless the type
// is non-arithmetic. This suppresses warnings with GCC.
template <bool is_typename_arithmetic_or_reference = true>
struct is_enum_helper
{
template <typename T> struct type
{
BOOST_STATIC_CONSTANT(bool, value = false);
};
};
В противном случае проверьте, можно ли преобразовать в int
:
template <>
struct is_enum_helper<false>
{
template <typename T> struct type
: ::boost::is_convertible<typename boost::add_reference<T>::type,::boost::detail::int_convertible>
{
};
};
Если вы хотите сделать это так же, как Boost, вам придется определить все эти другие черты. <type_traits>
вот так.