Boost logo

Boost :

Subject: Re: [boost] [iterators]: collection_keys and collection_values
From: Akira Takahashi (faithandbrave_at_[hidden])
Date: 2012-07-25 21:17:36


Hi,

2012/7/26 Igor Lubashev <igorlord_at_[hidden]>:
> I'd like to propose adding collection_keys and collection_values to iterators library.
>
> ======== Motivation ========
>
> I find myself very often having to iterate over all keys or values of a map (or multimap). The best I can do is to use BOOST_FOREACH to iterate over the collection value_type pairs and then work with .first or .second. That makes for awkward and unclear code.

Boost.Range has map_keys and map_values range adaptors.
http://www.boost.org/doc/libs/1_50_0/libs/range/doc/html/range/reference/adaptors/reference/map_keys.html
http://www.boost.org/doc/libs/1_50_0/libs/range/doc/html/range/reference/adaptors/reference/map_values.html

and Range Extension (in formal review queue) has more feature.
http://dl.dropbox.com/u/1682460/git/OvenToBoost/libs/range/doc/html/range_extension/reference/range_adaptors/elements.html
http://dl.dropbox.com/u/1682460/git/OvenToBoost/libs/range/doc/html/range_extension/reference/range_adaptors/elements_key.html

>>========================
Akira Takahashi
mailto:faithandbrave_at_[hidden]
site: https://sites.google.com/site/faithandbrave/about/en


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