From: "Richard Wolf" <richard@student.usyd.edu.au>
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
"Peter Dimov" <pdimov@mmltd.net> wrote in message news:00ce01c24f65$03862790$1d00a8c0@pdimov2... 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@boost-consulting.com * http://www.boost-consulting.com