Boost logo

Boost :

Subject: Re: [boost] [range] Should ranges really propagate constess to the data ?
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2011-07-25 04:01:09


Den 24-07-2011 16:04, Mathias Gaunard skrev:
> On 07/24/2011 03:25 PM, Neil Groves wrote:
>> and make the
>> sub_range a very questionable abstraction since one would have to
>> chose the
>> const or mutable version of the Range iterator by an explicit means
>> making
>> it almost indistinguishable from iterator_range.
>
> I thought that was the point of sub_range: to be the same as
> iterator_range, except the template parameter it takes is a range rather
> than an iterator, simplifying things when only ranges and not iterators
> are involved.
>

+ propagation of constness.

Consider using sub_range<T> as the type of a member variable.

It would be very annoying in some cases that we cannot return a view
that is const-correct and which requires us to construct a temporary
view instead of just returning a reference to the existing view.

-Thorsten


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