From a75ba5f2afa3b89fbcc97e0715108768ff45e02f Mon Sep 17 00:00:00 2001 From: Michel Morin Date: Fri, 31 Aug 2012 03:30:51 +0000 Subject: [PATCH] Fix preprocessor usage (and synchronize the style); fixes #7306 [SVN r80325] --- include/boost/type_traits/is_convertible.hpp | 53 ++++++++++++-------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/include/boost/type_traits/is_convertible.hpp b/include/boost/type_traits/is_convertible.hpp index ca56c85..9f58183 100644 --- a/include/boost/type_traits/is_convertible.hpp +++ b/include/boost/type_traits/is_convertible.hpp @@ -137,11 +137,12 @@ struct is_convertible_basic_impl typedef typename add_lvalue_reference::type lvalue_type; typedef typename add_rvalue_reference::type rvalue_type; static lvalue_type _m_from; - static bool const value = #if !defined(BOOST_NO_RVALUE_REFERENCES) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 6))) + static bool const value = sizeof( boost::detail::checker::_m_check(static_cast(_m_from), 0) ) == sizeof(::boost::type_traits::yes_type); #else + static bool const value = sizeof( boost::detail::checker::_m_check(_m_from, 0) ) == sizeof(::boost::type_traits::yes_type); #endif @@ -178,13 +179,15 @@ struct is_convertible_basic_impl typedef typename add_rvalue_reference::type rvalue_type; static lvalue_type _m_from; - BOOST_STATIC_CONSTANT(bool, value = #ifndef BOOST_NO_RVALUE_REFERENCES + BOOST_STATIC_CONSTANT(bool, value = sizeof( _m_check(static_cast(_m_from), 0) ) == sizeof(::boost::type_traits::yes_type) -#else - sizeof( _m_check(_m_from, 0) ) == sizeof(::boost::type_traits::yes_type) -#endif ); +#else + BOOST_STATIC_CONSTANT(bool, value = + sizeof( _m_check(_m_from, 0) ) == sizeof(::boost::type_traits::yes_type) + ); +#endif }; #elif defined(__DMC__) @@ -212,13 +215,15 @@ struct is_convertible_basic_impl // Static constants sometime cause the conversion of _m_from to To to be // called. This doesn't happen with an enum. - enum { value = #ifndef BOOST_NO_RVALUE_REFERENCES + enum { value = sizeof( _m_check(static_cast(_m_from), 0, 0) ) == sizeof(::boost::type_traits::yes_type) -#else - sizeof( _m_check(_m_from, 0, 0) ) == sizeof(::boost::type_traits::yes_type) -#endif }; +#else + enum { value = + sizeof( _m_check(_m_from, 0, 0) ) == sizeof(::boost::type_traits::yes_type) + }; +#endif }; #elif defined(__MWERKS__) @@ -249,13 +254,15 @@ struct is_convertible_basic_impl_aux typedef typename add_rvalue_reference::type rvalue_type; static lvalue_type _m_from; - BOOST_STATIC_CONSTANT(bool, value = #ifndef BOOST_NO_RVALUE_REFERENCES + BOOST_STATIC_CONSTANT(bool, value = sizeof( _m_check(static_cast(_m_from), 0) ) == sizeof(::boost::type_traits::yes_type) -#else - sizeof( _m_check(_m_from, 0) ) == sizeof(::boost::type_traits::yes_type) -#endif ); +#else + BOOST_STATIC_CONSTANT(bool, value = + sizeof( _m_check(_m_from, 0) ) == sizeof(::boost::type_traits::yes_type) + ); +#endif }; template @@ -266,13 +273,15 @@ struct is_convertible_basic_impl_aux typedef typename add_lvalue_reference::type lvalue_type; typedef typename add_rvalue_reference::type rvalue_type; static lvalue_type _m_from; - BOOST_STATIC_CONSTANT(bool, value = #ifndef BOOST_NO_RVALUE_REFERENCES + BOOST_STATIC_CONSTANT(bool, value = sizeof( _m_check(static_cast(_m_from)) ) == sizeof(::boost::type_traits::yes_type) -#else - sizeof( _m_check(_m_from) ) == sizeof(::boost::type_traits::yes_type) -#endif ); +#else + BOOST_STATIC_CONSTANT(bool, value = + sizeof( _m_check(_m_from) ) == sizeof(::boost::type_traits::yes_type) + ); +#endif }; template @@ -303,13 +312,15 @@ struct is_convertible_basic_impl #pragma warning(disable:6334) #endif #endif - BOOST_STATIC_CONSTANT(bool, value = #ifndef BOOST_NO_RVALUE_REFERENCES + BOOST_STATIC_CONSTANT(bool, value = sizeof( _m_check(static_cast(_m_from)) ) == sizeof(::boost::type_traits::yes_type) -#else - sizeof( _m_check(_m_from) ) == sizeof(::boost::type_traits::yes_type) -#endif ); +#else + BOOST_STATIC_CONSTANT(bool, value = + sizeof( _m_check(_m_from) ) == sizeof(::boost::type_traits::yes_type) + ); +#endif #ifdef BOOST_MSVC #pragma warning(pop) #endif