Chris@16: #ifndef POINTEE_DWA200415_HPP
Chris@16: # define POINTEE_DWA200415_HPP
Chris@16:
Chris@16: //
Chris@16: // Copyright David Abrahams 2004. Use, modification and distribution is
Chris@16: // subject to the Boost Software License, Version 1.0. (See accompanying
Chris@16: // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16: //
Chris@16: // typename pointee
::type provides the pointee type of P.
Chris@16: //
Chris@16: // For example, it is T for T* and X for shared_ptr.
Chris@16: //
Chris@16: // http://www.boost.org/libs/iterator/doc/pointee.html
Chris@16: //
Chris@16:
Chris@16: # include
Chris@16: # include
Chris@16: # include
Chris@16: # include
Chris@16: # include
Chris@16: # include
Chris@16:
Chris@101: namespace boost {
Chris@16:
Chris@16: namespace detail
Chris@16: {
Chris@16: template
Chris@16: struct smart_ptr_pointee
Chris@16: {
Chris@16: typedef typename P::element_type type;
Chris@16: };
Chris@16:
Chris@16: template
Chris@16: struct iterator_pointee
Chris@16: {
Chris@16: typedef typename iterator_traits::value_type value_type;
Chris@101:
Chris@16: struct impl
Chris@16: {
Chris@16: template
Chris@16: static char test(T const&);
Chris@101:
Chris@16: static char (& test(value_type&) )[2];
Chris@101:
Chris@16: static Iterator& x;
Chris@16: };
Chris@101:
Chris@16: BOOST_STATIC_CONSTANT(bool, is_constant = sizeof(impl::test(*impl::x)) == 1);
Chris@101:
Chris@16: typedef typename mpl::if_c<
Chris@16: # if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
Chris@16: ::boost::detail::iterator_pointee::is_constant
Chris@16: # else
Chris@16: is_constant
Chris@101: # endif
Chris@16: , typename add_const::type
Chris@16: , value_type
Chris@16: >::type type;
Chris@16: };
Chris@16: }
Chris@16:
Chris@16: template
Chris@16: struct pointee
Chris@16: : mpl::eval_if<
Chris@16: detail::is_incrementable
Chris@16: , detail::iterator_pointee
Chris@16: , detail::smart_ptr_pointee
Chris@16: >
Chris@16: {
Chris@16: };
Chris@101:
Chris@16: } // namespace boost
Chris@16:
Chris@16: #endif // POINTEE_DWA200415_HPP