Boost logo

Boost :

Subject: Re: [boost] [range] adaptors vs. rvalue to lvalue& binding
From: Michel Morin (mimomorin_at_[hidden])
Date: 2012-03-22 11:02:56

Arno Schödl wrote:
> 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.
> template<typename Range>
> void modifies_range( Range& rng );
> Any thoughts?

You can use something like this:

template <typename Range>
typename boost::enable_if<
    // Check whether
    // `typename range_reference<typename remove_reference<Range>::type>::type`
    // is non-const reference
modify_range(Range&& rng)
    /* … */


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