Boost logo

Boost :

Subject: Re: [boost] [iterator] why isn't there a mapped_type iterator adaptor in boost?
From: Mostafa (mostafa_working_away_at_[hidden])
Date: 2010-05-15 15:18:56


> Mostafa wrote:
>> 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.
>
> Do
>
> http://www.boost.org/doc/libs/1_43_0/libs/range/doc/html/range/reference/adaptors/reference/map_keys.html
>
> and
>
> http://www.boost.org/doc/libs/1_43_0/libs/range/doc/html/range/reference/adaptors/reference/map_values.html
>
> address your needs? Not exactly iterator adaptors though...
>
> HTH,
> Gevorg
>

I don't know. I'm interested in using a mapped_type iterator adaptor with
Thomas Becker's any_iterator (see
http://thbecker.net/free_software_utilities/type_erasure_for_cpp_iterators/any_iterator.html).
With any_iterator, I can do the following

any_iterator<...> it_any =
my_mapped_type_iterator_adaptor(map_instance.begin());

How would I go about doing that with ranges?

Thanks,

-Mostafa


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