diff --git a/include/boost/mpl/aux_/has_rebind.hpp b/include/boost/mpl/aux_/has_rebind.hpp index 83c5d6c..9c3a48e 100644 --- a/include/boost/mpl/aux_/has_rebind.hpp +++ b/include/boost/mpl/aux_/has_rebind.hpp @@ -23,6 +23,10 @@ #include "boost/mpl/aux_/config/overload_resolution.hpp" #include "boost/config.hpp" +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 +# include "boost/type_traits/is_reference.hpp" +#endif + namespace boost { namespace mpl { namespace aux { @@ -57,21 +61,40 @@ struct has_rebind // note that the code is _not_ standard-conforming, but it works, // and it resolves some nasty ICE cases with the above implementation -template< typename T, typename rebind = int > -struct has_rebind : T +template < bool ref = true > +struct has_rebind_impl { - private: - static no_tag test(int*); - static yes_tag test(...); + template < typename T > struct apply + { + BOOST_STATIC_CONSTANT(bool, value = false); + }; +}; - public: - BOOST_STATIC_CONSTANT(bool, value = - sizeof(test(static_cast(0))) != sizeof(no_tag) - ); +template <> +struct has_rebind_impl< false > +{ + template < typename T, typename rebind = int > + struct apply : T + { + private: + static no_tag test(int*); + static yes_tag test(...); + + public: + BOOST_STATIC_CONSTANT( + bool, value = sizeof(test(static_cast(0))) != sizeof(no_tag) + ); + }; +}; + +template < typename T > +struct has_rebind + : has_rebind_impl::value>::template apply +{ }; # define AUX_HAS_REBIND_SPEC(T) \ - template<> struct has_rebind \ + template<> struct has_rebind \ { \ enum { value = false }; \ }; \ diff --git a/include/boost/mpl/aux_/preprocessed/msvc60/bind.hpp b/include/boost/mpl/aux_/preprocessed/msvc60/bind.hpp index e101402..b989d15 100644 --- a/include/boost/mpl/aux_/preprocessed/msvc60/bind.hpp +++ b/include/boost/mpl/aux_/preprocessed/msvc60/bind.hpp @@ -88,11 +88,32 @@ aux::yes_tag is_bind_helper(arg*); template< typename F, typename T > aux::yes_tag is_bind_helper(bind1st< F,T >*); template< typename F, typename T > aux::yes_tag is_bind_helper(bind2nd< F,T >*); -template< typename T > struct is_bind_template +template < bool ref = true > +struct is_bind_template_impl +{ + template < typename T > + struct apply + { + BOOST_STATIC_CONSTANT(bool, value = false); + }; +}; + +template <> +struct is_bind_template_impl +{ + template< typename T > + struct apply + { + BOOST_STATIC_CONSTANT(bool, value = sizeof(aux::is_bind_helper(static_cast(0))) + == sizeof(aux::yes_tag) + ); + }; +}; + +template< typename T > struct is_bind_template + : is_bind_template_impl::value> + ::template apply< T > { - BOOST_STATIC_CONSTANT(bool, value = sizeof(aux::is_bind_helper(static_cast(0))) - == sizeof(aux::yes_tag) - ); }; } // namespace aux diff --git a/include/boost/mpl/aux_/preprocessed/msvc70/bind.hpp b/include/boost/mpl/aux_/preprocessed/msvc70/bind.hpp index e101402..b989d15 100644 --- a/include/boost/mpl/aux_/preprocessed/msvc70/bind.hpp +++ b/include/boost/mpl/aux_/preprocessed/msvc70/bind.hpp @@ -88,11 +88,32 @@ aux::yes_tag is_bind_helper(arg*); template< typename F, typename T > aux::yes_tag is_bind_helper(bind1st< F,T >*); template< typename F, typename T > aux::yes_tag is_bind_helper(bind2nd< F,T >*); -template< typename T > struct is_bind_template +template < bool ref = true > +struct is_bind_template_impl +{ + template < typename T > + struct apply + { + BOOST_STATIC_CONSTANT(bool, value = false); + }; +}; + +template <> +struct is_bind_template_impl +{ + template< typename T > + struct apply + { + BOOST_STATIC_CONSTANT(bool, value = sizeof(aux::is_bind_helper(static_cast(0))) + == sizeof(aux::yes_tag) + ); + }; +}; + +template< typename T > struct is_bind_template + : is_bind_template_impl::value> + ::template apply< T > { - BOOST_STATIC_CONSTANT(bool, value = sizeof(aux::is_bind_helper(static_cast(0))) - == sizeof(aux::yes_tag) - ); }; } // namespace aux diff --git a/include/boost/mpl/bind.hpp b/include/boost/mpl/bind.hpp index cd66ab6..4472cf0 100644 --- a/include/boost/mpl/bind.hpp +++ b/include/boost/mpl/bind.hpp @@ -25,6 +25,11 @@ #include "boost/mpl/aux_/config/bind.hpp" #include "boost/mpl/aux_/config/lambda.hpp" +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# include "boost/type_traits/is_reference.hpp" +#endif + + #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include "boost/mpl/placeholder.hpp" # include "boost/mpl/void.hpp" @@ -295,12 +300,32 @@ aux::yes_tag is_bind_helper(arg*); template< typename F, typename T > aux::yes_tag is_bind_helper(bind1st*); template< typename F, typename T > aux::yes_tag is_bind_helper(bind2nd*); -template< typename T > struct is_bind_template +template < bool ref = true > +struct is_bind_template_impl +{ + template < typename T > + struct apply + { + BOOST_STATIC_CONSTANT(bool, value = false); + }; +}; + +template <> +struct is_bind_template_impl +{ + template< typename T > + struct apply + { + BOOST_STATIC_CONSTANT(bool, value = sizeof(aux::is_bind_helper(static_cast(0))) + == sizeof(aux::yes_tag) + ); + }; +}; + +template< typename T > struct is_bind_template + : is_bind_template_impl::value> + ::template apply< T > { - BOOST_STATIC_CONSTANT(bool, value = - sizeof(aux::is_bind_helper(static_cast(0))) - == sizeof(aux::yes_tag) - ); }; #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION