|
Boost : |
Subject: Re: [boost] [range] new adaptor for iterating over equal_ranges
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2010-04-23 08:23:49
Thorsten Ottosen wrote:
> Hi Neil & others,
>
> I think it could be useful with a range adaptor of the following kind to
> iterate over equal_ranges in a multimap. E.g.
>
> SomeMultiMap map = ...;
> for( auto rng : map | boost::adaptors::equal_ranged )
> for( auto iter : rng )
> {
> // do something with the objects with equal keys
> }
>
> The resulting range would probably be bidirectional with value_type
> std::pair<boost::range_iterator<SomeMultiMap>::type,...>.
That would be trivial to do with boost::consumer_iterator (which is
being renamed to boost::segment_iterator) that is part of my Unicode
library.
The value type is boost::sub_range<SomeMultiMap>.
I would quite like my iterator/range adaptors developed for Unicode to
be included into iterator/range at some point, but I've had little
feedback on them.
I've got:
* join_iterator, that lazily concatenates a tuple of ranges into a
single range,
* segment_iterator, that adapts a range as a range of subranges with a
lazily evaluated segmentation criterion,
* convert_iterator, that lazily converts N to M elements in a range.
All three are bidirectional (I suppose join_iterator could maybe be
more, but that's not supported)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk