diff --git a/include/boost/iterator/indirect_iterator.hpp b/include/boost/iterator/indirect_iterator.hpp index 59babdf..c362657 100644 --- a/include/boost/iterator/indirect_iterator.hpp +++ b/include/boost/iterator/indirect_iterator.hpp @@ -56,6 +56,7 @@ namespace boost namespace aux { BOOST_MPL_HAS_XXX_TRAIT_DEF(element_type) + BOOST_MPL_HAS_XXX_TRAIT_DEF(type) } template @@ -133,6 +134,7 @@ namespace boost template struct default_indirect_value { +#if 0 typedef typename remove_cv< typename referent::type >::type referent_t; @@ -140,11 +142,27 @@ namespace boost typedef typename mpl::if_< mpl::or_< class_has_element_type - , iterator_is_mutable + , iterator_is_mutable // This doesn't work when Dereferencable is not an iterator. -JGS > , referent_t , referent_t const >::type type; +#else + template + struct get_from_iter { + typedef typename mpl::apply_if< + iterator_is_mutable + , iterator_value + , iterator_value const + >::type type; + }; + + typedef typename mpl::apply_if< + aux::has_type< referent > + , referent + , get_from_iter + >::type type; +#endif }; template @@ -173,6 +191,7 @@ namespace boost // Dereferenceable::element_type if such a member exists (thus // handling the boost smart pointers and auto_ptr), and // iterator_traits::value_type otherwise. +#if 0 template struct referent : mpl::apply_if< @@ -181,6 +200,20 @@ namespace boost , iterator_value > {}; +#else + namespace detail { + struct has_no_type { }; + } + template + struct referent + : mpl::if_< + detail::class_has_element_type + , detail::element_type + , detail::has_no_type + >::type + {}; + +#endif template < class Iterator