Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2002-08-07 13:42:03


Hi George,

Are you supplying types for the Value, Reference, etc. parameters of
indirect_iterator_generator, or are you relying on the defaults? I think
the problem is that you are relying on the defaults, which is to look at
std::iterator_traits. If instead you supply the Value type, etc. I think
things should work.

Cheers,
Jeremy

On Wed, 7 Aug 2002, George A. Heintzelman wrote:
george>
george> There's a claim in the iterator_adaptor documentation
george> (http://www.boost.org/libs/utility/indirect_iterator.htm) that "For
george> example, [indirect_iterator] makes it possible to view a container of
george> pointers or smart-pointers (e.g. std::list<boost::shared_ptr<foo> >)
george> as if it were a container of the pointed-to type."
george>
george> Has anyone actually ever used an indirect_iterator for this? I am using
george> a somewhat old version of boost, so it may be me, but I looked at the
george> new code and I can't see differences that fix my problem, which is:
george>
george> std::iterator_traits< boost::shared_ptr<T> > isn't defined, so the
george> indirect_iterator doesn't have a value_type it can latch onto.
george>
george> Well, it's not hard to fix up a template that does this, if you have
george> partial specialization, so I did that, but it doesn't seem like the
george> right solution since a shared_ptr isn't really an iterator, it's just
george> dereferenceable. Is there a fix (that I'm missing in my inspection of
george> the new code) or is this something that ought to be thought about?
george>
george> George Heintzelman

----------------------------------------------------------------------
 Jeremy Siek http://php.indiana.edu/~jsiek/
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------


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