Boost logo

Boost :

From: Gavin Lambert (boost_at_[hidden])
Date: 2020-03-29 21:58:23

On 30/03/2020 05:21, Frederick Gotham wrote:
> Earlier today I wrote the following two lines of code:
> auto const my_range = v | boost::adaptors::sliced(1,15) |
> boost::adaptors::strided(2);
> boost::range::transform( my_range, my_range.begin(), std::bit_not<uint8_t>() );
> However it would have been nice as a one-liner:
> boost::range::transform( v | boost::adaptors::sliced(1,15) |
> boost::adaptors::strided(2), std::bit_not<uint8_t>() );
> Why isn't there a form of "range::transform" that can transform in
> place (and therefore takes exactly two arguments)?

I would imagine that mutating an adapted range in-place may not always
be safe -- eg. a sorted/filtered range, especially if you're modifying
the field used as key.

But you could always write your own wrapper that lets you do that if you

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