diff --git a/include/boost/detail/call_traits.hpp b/include/boost/detail/call_traits.hpp index ac198c2..4753f7e 100644 --- a/include/boost/detail/call_traits.hpp +++ b/include/boost/detail/call_traits.hpp @@ -34,20 +34,32 @@ namespace boost{ namespace detail{ -template +template +struct ct_imp2 +{ + typedef const T& param_type; +}; + +template +struct ct_imp2 +{ + typedef const T param_type; +}; + +template struct ct_imp { typedef const T& param_type; }; template -struct ct_imp +struct ct_imp { - typedef T const param_type; + typedef typename ct_imp2::param_type param_type; }; -template -struct ct_imp +template +struct ct_imp { typedef T const param_type; }; @@ -67,7 +79,11 @@ public: // however compiler bugs prevent this - instead pass three bool's to // ct_imp and add an extra partial specialisation // of ct_imp to handle the logic. (JM) - typedef typename detail::ct_imp::type>::value, ::boost::is_arithmetic::type>::value, sizeof(T) <= sizeof(void*)>::param_type param_type; + typedef typename detail::ct_imp< + T, + ::boost::is_pointer::value, + ::boost::is_arithmetic::value + >::param_type param_type; }; template diff --git a/include/boost/detail/ob_call_traits.hpp b/include/boost/detail/ob_call_traits.hpp index 918ea7b..179f9db 100644 --- a/include/boost/detail/ob_call_traits.hpp +++ b/include/boost/detail/ob_call_traits.hpp @@ -64,7 +64,8 @@ struct reference_call_traits typedef T const_reference; typedef T param_type; }; -template + +template struct call_traits_chooser { template @@ -73,8 +74,9 @@ struct call_traits_chooser typedef standard_call_traits type; }; }; + template <> -struct call_traits_chooser +struct call_traits_chooser { template struct rebind @@ -82,8 +84,9 @@ struct call_traits_chooser typedef simple_call_traits type; }; }; + template <> -struct call_traits_chooser +struct call_traits_chooser { template struct rebind @@ -91,14 +94,52 @@ struct call_traits_chooser typedef reference_call_traits type; }; }; + +template +struct call_traits_sizeof_chooser2 +{ + template + struct small_rebind + { + typedef simple_call_traits small_type; + }; +}; + +template<> +struct call_traits_sizeof_chooser2 +{ + template + struct small_rebind + { + typedef standard_call_traits small_type; + }; +}; + +template <> +struct call_traits_chooser +{ + template + struct rebind + { + enum { sizeof_choice = (sizeof(T) <= sizeof(void*)) }; + typedef call_traits_sizeof_chooser2<(sizeof(T) <= sizeof(void*))> chooser; + typedef typename chooser::template small_rebind bound_type; + typedef typename bound_type::small_type type; + }; +}; + } // namespace detail template struct call_traits { private: - typedef detail::call_traits_chooser<(is_pointer::value || is_arithmetic::value) && sizeof(T) <= sizeof(void*), is_reference::value> chooser; - typedef typename chooser::template rebind bound_type; - typedef typename bound_type::type call_traits_type; + typedef detail::call_traits_chooser< + ::boost::is_pointer::value, + ::boost::is_arithmetic::value, + ::boost::is_reference::value + > chooser; + typedef typename chooser::template rebind bound_type; + typedef typename bound_type::type call_traits_type; public: typedef typename call_traits_type::value_type value_type; typedef typename call_traits_type::reference reference;