Boost logo

Boost :

From: Joseph Gauterin (joseph.gauterin_at_[hidden])
Date: 2007-08-10 07:56:43


The Boost.Iterator specialized adaptor 'indirect_iterator' allows
iteration over the objects pointed-to by a sequence. This could easily
be implemented using boost::transform_iterator and a dereferencing
function object, but the case of iterating over pointed-to objects is
so common that it deserves its own convenience iterator.

In my own code I know that iterating over the values or keys of an
associative container is a common thing to do. I think they deserve
their own specialized iterator adaptors if it is a common thing to do
amongst Boost users in general - if it's more of a niche requirement
then I agree that boost::transform_iterator + function object would be
a better way forward.

>BTW, I think that boost.bimap already provides them.
I'd say that's a good reason to provide equivilent functionality for
std::(multi)map and std::tr1::unordered_(multi)map.

>Also function object wrappers for boost.tuple get<N> would really be useful.
There's already a free function (boost::tuples::get<N>) that would
work here (it is an actual function, not a function object, so the
usual optimization issues are present), but it only works on tuples,
not on std::pair - so it won't work with std::(multi)map and
std::tr1::unordered_(multi)map.


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