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 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.