From 07c3946e778dad3c80747b3f933bf41799284729 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sun, 30 Jan 2005 15:41:12 +0000 Subject: [PATCH] Make is_enum work with types that can not be converted to references (incomplete arrays for example). [SVN r26936] --- include/boost/type_traits/is_enum.hpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/boost/type_traits/is_enum.hpp b/include/boost/type_traits/is_enum.hpp index 0661c97..21b3baa 100644 --- a/include/boost/type_traits/is_enum.hpp +++ b/include/boost/type_traits/is_enum.hpp @@ -15,6 +15,7 @@ #include "boost/type_traits/is_arithmetic.hpp" #include "boost/type_traits/is_reference.hpp" #include "boost/type_traits/is_convertible.hpp" +#include "boost/type_traits/is_array.hpp" #ifdef __GNUC__ #include #endif @@ -91,15 +92,15 @@ template <> struct is_enum_helper { template struct type - : ::boost::is_convertible + : ::boost::is_convertible::type,::boost::detail::int_convertible> { }; }; template struct is_enum_impl { - typedef ::boost::add_reference ar_t; - typedef typename ar_t::type r_type; + //typedef ::boost::add_reference ar_t; + //typedef typename ar_t::type r_type; #if defined(__GNUC__) @@ -110,6 +111,7 @@ template struct is_enum_impl , ::boost::is_reference::value , ::boost::is_function::value , is_class_or_union::value + , is_array::value >::value)); #else BOOST_STATIC_CONSTANT(bool, selector = @@ -117,6 +119,7 @@ template struct is_enum_impl ::boost::is_arithmetic::value , ::boost::is_reference::value , ::boost::is_function::value + , is_array::value >::value)); #endif // BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION @@ -126,6 +129,7 @@ template struct is_enum_impl ::boost::is_arithmetic::value , ::boost::is_reference::value , is_class_or_union::value + , is_array::value // However, not doing this on non-conforming compilers prevents // a dependency recursion. >::value)); @@ -139,7 +143,7 @@ template struct is_enum_impl typedef ::boost::detail::is_enum_helper se_t; #endif - typedef typename se_t::template type helper; + typedef typename se_t::template type helper; BOOST_STATIC_CONSTANT(bool, value = helper::value); };