Boost logo

Boost :

Subject: Re: [boost] [range] adaptors vs. rvalue to lvalue& binding
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-03-22 13:27:08

on Thu Mar 22 2012, Arno Schödl <> wrote:

> Hello,
> ideally I would like to use range-adapted lvalue ranges like any other lvalue ranges. Writing it down naively, as below, does not compile because LoadRefRange takes (and should take?) the range it modifies by lvalue&, while adaptor expressions are rvalues.

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.

 - make even the const_iterators for such adaptors mutable (writable) iterators

This accurately reflects the fact that such adaptors don't own their values.

Dave Abrahams
BoostPro Computing

Boost list run by bdawes at, gregod at, cpdaniel at, john at