Boost logo

Boost Users :

From: David Abrahams (yg-boost-users_at_[hidden])
Date: 2002-08-30 12:32:53


"Peter Dimov" <pdimov_at_[hidden]> wrote in message
news:00ce01c24f65$03862790$1d00a8c0_at_pdimov2...
> From: "Richard Wolf" <richard_at_[hidden]>
> >
> > Thank you. I suppose this means that the container must contain a type
> that
> > is an iterator rather than a pointer. A raw pointer works because raw
> > pointers are iterators. But....
> >
> > The documentation of Indirect Iterator Adapter says :
> >
> > "The indirect iterator adaptor augments an iterator by applying an extra
> > dereference inside of operator*(). For example, this iterator makes it
> > possible to view a container of pointers or smart-pointers (e.g.
> > std::list<boost::shared_ptr<foo> >) as if it were a container of the
> > pointed-to type."
> >
> > Is the documentation incorrect, or have I misunderstood?
>
> This has been discussed in the past on the [boost] list, see
>
> http://lists.boost.org/MailArchives/boost/msg33264.php
>
> In short, the claim is that the documentation is correct since it's
possible
> to make an indirect iterator that will work; it's just that
> make_indirect_iterator cannot be used for that.
>
> I have since added ::value_type to shared_ptr, but unfortunately, this is
> apparently not enough. Even though the indirect iterator adaptor needs
only
> the value_type, the attempt to instantiate std::iterator_traits means that
> make_indirect_iterator cannot work with shared_ptr.

Why is that? There's no reason that instantiating
std::iterator_traits<shared_ptr<T> > should cause a problem by itself.

--
-----------------------------------------------------------
           David Abrahams * Boost Consulting
dave_at_[hidden] * http://www.boost-consulting.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net