diff --git a/include/boost/tuple/detail/tuple_basic.hpp b/include/boost/tuple/detail/tuple_basic.hpp index b7c17b6..a1d3284 100644 --- a/include/boost/tuple/detail/tuple_basic.hpp +++ b/include/boost/tuple/detail/tuple_basic.hpp @@ -135,6 +135,8 @@ struct get_class<0> { // Nth element ot T, first element is at index 0 // ------------------------------------------------------- +#ifndef BOOST_NO_CV_SPECIALIZATIONS + template struct element { @@ -156,14 +158,69 @@ private: typedef typename T::tail_type Next; typedef typename element::type unqualified_type; public: +#if BOOST_WORKAROUND(__BORLANDC__,<0x600) + typedef const unqualified_type type; +#else typedef typename boost::add_const::type type; +#endif + }; template struct element<0,const T> { +#if BOOST_WORKAROUND(__BORLANDC__,<0x600) + typedef const typename T::head_type type; +#else typedef typename boost::add_const::type type; +#endif }; +#else // def BOOST_NO_CV_SPECIALIZATIONS + +namespace detail { + +template +struct element_impl +{ +private: + typedef typename T::tail_type Next; +public: + typedef typename element_impl::type type; +}; + +template +struct element_impl +{ +private: + typedef typename T::tail_type Next; +public: + typedef const typename element_impl::type type; +}; + +template +struct element_impl<0, T, false /* IsConst */> +{ + typedef typename T::head_type type; +}; + +template +struct element_impl<0, T, true /* IsConst */> +{ + typedef const typename T::head_type type; +}; + +} // end of namespace detail + + +template +struct element: + public detail::element_impl::value> +{ +}; + +#endif + + // -get function templates ----------------------------------------------- // Usage: get(aTuple)