Boost logo

Boost :

From: George A. Heintzelman (georgeh_at_[hidden])
Date: 2002-08-07 13:22:55


There's a claim in the iterator_adaptor documentation
(http://www.boost.org/libs/utility/indirect_iterator.htm) that "For
example, [indirect_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."

Has anyone actually ever used an indirect_iterator for this? I am using
a somewhat old version of boost, so it may be me, but I looked at the
new code and I can't see differences that fix my problem, which is:

std::iterator_traits< boost::shared_ptr<T> > isn't defined, so the
indirect_iterator doesn't have a value_type it can latch onto.

Well, it's not hard to fix up a template that does this, if you have
partial specialization, so I did that, but it doesn't seem like the
right solution since a shared_ptr isn't really an iterator, it's just
dereferenceable. Is there a fix (that I'm missing in my inspection of
the new code) or is this something that ought to be thought about?

George Heintzelman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk