fixed a bug in default_indirect_value

[SVN r21469]
This commit is contained in:
Jeremy Siek
2004-01-04 04:26:23 +00:00
parent 68e7d3f0d5
commit 798562e75b

View File

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