|
Boost : |
From: Dan Gohman (gohmandj_at_[hidden])
Date: 2001-12-05 11:37:52
On Wed, Dec 05, 2001 at 09:46:26AM -0500, David Abrahams wrote:
>
> boost::make_projection_iterator<std::select1st>(some_map.begin())
>
Could I suggest adding convenience versions of these to boost?
For my own code I have a make_key_iterator and make_data_iterator
that are based on the iterator adaptors library (although they
don't use projection_iterator currently). They are quite handy
for working with std::map. Perhaps better names for these might
be make_1st_iterator and make_2nd_iterator.
Another iterator that is useful is make_indexed_iterator, which
does for Boost tuples what the above do for pairs.
make_indexed_iterator<2>(x.begin())
where x.begin() is an iterator over a container of tuples.
This makes an iterator that presents the element at the
specified index of the tuples. I haven't used this one as
much because I don't (yet) use tuples much, and it could
probably use a better name :-).
Dan
-- Dan Gohman gohmandj_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk