Boost logo

Boost :

Subject: [boost] [iterator] why isn't there a mapped_type iterator adaptor in boost?
From: Mostafa (mostafa_working_away_at_[hidden])
Date: 2010-05-14 17:33:07


Hi all,

Why isn't there a mapped_type/key_type iterator adaptor in boost? (Just
in case it's not clear, something which allow one to iterator over the
keys or the mapped-values of a map/multimap.) I would think this is a
pretty common need.

By the way, going through the archives this is all I could dig up:

http://thread.gmane.org/gmane.comp.lib.boost.devel/117946

Additionaly something with a clearer syntax than the following would be
great:

        make_transform_iterator(
                map.begin(),
                boost::bind( &MAP_TYPE::value_type::first, _1 ))

ie, something along the lines of:

        take_mapped_type(map.begin())

Thanks,

-Mostafa


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