summaryrefslogtreecommitdiff
path: root/boost/type_traits/is_enum.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/type_traits/is_enum.hpp')
-rw-r--r--boost/type_traits/is_enum.hpp56
1 files changed, 17 insertions, 39 deletions
diff --git a/boost/type_traits/is_enum.hpp b/boost/type_traits/is_enum.hpp
index 7929c962a5..eada480a65 100644
--- a/boost/type_traits/is_enum.hpp
+++ b/boost/type_traits/is_enum.hpp
@@ -12,6 +12,7 @@
#define BOOST_TT_IS_ENUM_HPP_INCLUDED
#include <boost/type_traits/intrinsics.hpp>
+#include <boost/type_traits/integral_constant.hpp>
#ifndef BOOST_IS_ENUM
#include <boost/type_traits/add_reference.hpp>
#include <boost/type_traits/is_arithmetic.hpp>
@@ -21,16 +22,13 @@
#ifdef __GNUC__
#include <boost/type_traits/is_function.hpp>
#endif
-#include <boost/type_traits/config.hpp>
+#include <boost/type_traits/detail/config.hpp>
#if defined(BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION)
# include <boost/type_traits/is_class.hpp>
# include <boost/type_traits/is_union.hpp>
#endif
#endif
-// should be the last #include
-#include <boost/type_traits/detail/bool_trait_def.hpp>
-
namespace boost {
#ifndef BOOST_IS_ENUM
@@ -43,11 +41,7 @@ namespace detail {
template <typename T>
struct is_class_or_union
{
- BOOST_STATIC_CONSTANT(bool, value =
- (::boost::type_traits::ice_or<
- ::boost::is_class<T>::value
- , ::boost::is_union<T>::value
- >::value));
+ BOOST_STATIC_CONSTANT(bool, value = ::boost::is_class<T>::value || ::boost::is_union<T>::value);
};
#else
@@ -94,8 +88,8 @@ template <>
struct is_enum_helper<false>
{
template <typename T> struct type
- : public ::boost::is_convertible<typename boost::add_reference<T>::type,::boost::detail::int_convertible>
{
+ static const bool value = ::boost::is_convertible<typename boost::add_reference<T>::type, ::boost::detail::int_convertible>::value;
};
};
@@ -112,34 +106,28 @@ template <typename T> struct is_enum_impl
// order to correctly deduce that noncopyable types are not enums
// (dwa 2002/04/15)...
BOOST_STATIC_CONSTANT(bool, selector =
- (::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));
+ || ::boost::is_reference<T>::value
+ || ::boost::is_function<T>::value
+ || is_class_or_union<T>::value
+ || is_array<T>::value);
#else
// ...however, not checking is_class_or_union on non-conforming
// compilers prevents a dependency recursion.
BOOST_STATIC_CONSTANT(bool, selector =
- (::boost::type_traits::ice_or<
::boost::is_arithmetic<T>::value
- , ::boost::is_reference<T>::value
- , ::boost::is_function<T>::value
- , is_array<T>::value
- >::value));
+ || ::boost::is_reference<T>::value
+ || ::boost::is_function<T>::value
+ || is_array<T>::value);
#endif // BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
#else // !defined(__GNUC__):
BOOST_STATIC_CONSTANT(bool, selector =
- (::boost::type_traits::ice_or<
::boost::is_arithmetic<T>::value
- , ::boost::is_reference<T>::value
- , is_class_or_union<T>::value
- , is_array<T>::value
- >::value));
+ || ::boost::is_reference<T>::value
+ || is_class_or_union<T>::value
+ || is_array<T>::value);
#endif
@@ -155,34 +143,24 @@ template <typename T> struct is_enum_impl
BOOST_STATIC_CONSTANT(bool, value = helper::value);
};
-// these help on compilers with no partial specialization support:
-BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,void,false)
-#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
-BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,void const,false)
-BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,void volatile,false)
-BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,void const volatile,false)
-#endif
-
} // namespace detail
-BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_enum,T,::boost::detail::is_enum_impl<T>::value)
+template <class T> struct is_enum : public integral_constant<bool, ::boost::detail::is_enum_impl<T>::value> {};
#else // __BORLANDC__
//
// buggy is_convertible prevents working
// implementation of is_enum:
-BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_enum,T,false)
+template <class T> struct is_enum : public integral_constant<bool, false> {};
#endif
#else // BOOST_IS_ENUM
-BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_enum,T,BOOST_IS_ENUM(T))
+template <class T> struct is_enum : public integral_constant<bool, BOOST_IS_ENUM(T)> {};
#endif
} // namespace boost
-#include <boost/type_traits/detail/bool_trait_undef.hpp>
-
#endif // BOOST_TT_IS_ENUM_HPP_INCLUDED