Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-08-29 09:04:36


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.


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