Boost logo

Boost :

Subject: Re: [boost] [range] - Proposal to change the indexed range adaptor
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2010-10-31 17:02:19


On Sun, Oct 31, 2010 at 8:43 PM, Neil Groves <neil_at_[hidden]>wrote:

> On Sat, Oct 30, 2010 at 6:28 PM, Robert Jones <robertgbjones_at_[hidden]
> >wrote:
>
> > On Sat, Oct 30, 2010 at 12:38 PM, Neil Groves <neil_at_[hidden]
> > >wrote:
> >
> > >
> > > I propose that a breaking change is made to the index range adaptor so
> > that
> > > it returns a pair<original_reference_type, index_type>.
> > >
> > >
> > Hi Neil
> >
> > Could you provide a use-case example, before and after.
> >
> >
> Certainly. I should have thought to do this in the original email. Thank
> you
> for taking the time to help me acquire information.
>
> Before:
>
> BOOST_FOREACH( auto item, rng | index )
> {
> // access to the index is not possible - doh :-(
> // The return type of the dereferenced element from an index range
> adaptor loses the index
> const element_type& elem = item;
> }
>
>
Hi Neil

...so in the 'BEFORE' case, how can this be written now, with your
library as it stands (presumably not with BOOST_FOREACH)?

Thx

- Rob.

ps. I must, rather sheepishly, admit to not having been able to use your
library in real code - sorry! Having actively encouraged you write it, I
personally am constrained to 1.39 and before - doesn't that just suck!


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