diff --git a/include/boost/type_traits/add_reference.hpp b/include/boost/type_traits/add_reference.hpp index 0465387..5e7ae9e 100644 --- a/include/boost/type_traits/add_reference.hpp +++ b/include/boost/type_traits/add_reference.hpp @@ -18,23 +18,10 @@ namespace boost { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_reference,T,T&) -BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_reference,T&,T&) - -// these full specialisations are always required: -BOOST_TT_AUX_TYPE_TRAIT_SPEC1(add_reference,void,void) -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -BOOST_TT_AUX_TYPE_TRAIT_SPEC1(add_reference,void const,void const) -BOOST_TT_AUX_TYPE_TRAIT_SPEC1(add_reference,void volatile,void volatile) -BOOST_TT_AUX_TYPE_TRAIT_SPEC1(add_reference,void const volatile,void const volatile) -#endif - -#elif defined(BOOST_MSVC6_MEMBER_TEMPLATES) - namespace detail { +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && defined(BOOST_MSVC6_MEMBER_TEMPLATES) + template struct reference_adder { @@ -63,6 +50,20 @@ struct add_reference_impl typedef typename result::type type; }; +#else + +template +struct add_reference_impl +{ + typedef T& type; +}; + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +BOOST_TT_AUX_TYPE_TRAIT_IMPL_PARTIAL_SPEC1_1(typename T,add_reference,T&,T&) +#endif + +#endif + // these full specialisations are always required: BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void,void) #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS @@ -75,9 +76,6 @@ BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(add_reference,void const volatile,void const BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_reference,T,typename detail::add_reference_impl::type) -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - - } // namespace boost #include "boost/type_traits/detail/type_trait_undef.hpp" diff --git a/include/boost/type_traits/detail/type_trait_def.hpp b/include/boost/type_traits/detail/type_trait_def.hpp index 8bafd72..0b5d492 100644 --- a/include/boost/type_traits/detail/type_trait_def.hpp +++ b/include/boost/type_traits/detail/type_trait_def.hpp @@ -57,3 +57,10 @@ template< param1, param2 > struct trait \ typedef result; \ }; \ /**/ + +#define BOOST_TT_AUX_TYPE_TRAIT_IMPL_PARTIAL_SPEC1_1(param,trait,spec,result) \ +template< param > struct trait##_impl \ +{ \ + typedef result type; \ +}; \ +/**/ diff --git a/include/boost/type_traits/detail/type_trait_undef.hpp b/include/boost/type_traits/detail/type_trait_undef.hpp index d979005..9259e6a 100644 --- a/include/boost/type_traits/detail/type_trait_undef.hpp +++ b/include/boost/type_traits/detail/type_trait_undef.hpp @@ -21,3 +21,4 @@ #undef BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1 #undef BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1 #undef BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2 +#undef BOOST_TT_AUX_TYPE_TRAIT_IMPL_PARTIAL_SPEC1_1