Boost logo

Boost :

Subject: Re: [boost] [range] adaptors vs. rvalue to lvalue& binding
From: Eric Niebler (eric_at_[hidden])
Date: 2012-03-25 01:49:23


On 3/23/2012 8:33 AM, Thorsten Ottosen wrote:
> On 3/23/2012 4:20 PM, Dave Abrahams wrote:
>>
>>>
>>> One possibility:
>>>
>>> - make adaptor expressions return const rvalues. The const rvalues
>>> will
>>> bind to T& arguments (where T is a template parameter) by
>>> deducing T
>>> to be const.
>
>
> I don't like this one.

For the record, Boost.Proto uses the const rvalue trick extensively. It
works well in practice, in my experience.

>>> - make even the const_iterators for such adaptors mutable
>>> (writable) iterators
>>>
>>> This accurately reflects the fact that such adaptors don't own their
>>> values.
>
> Seems reasonable.

Agreed.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

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