Boost logo

Boost :

Subject: Re: [boost] [range] fat iterators?
From: Jonathan Wakely (jwakely.boost_at_[hidden])
Date: 2013-11-07 15:49:11

On 7 November 2013 17:27, Nathan Ridge wrote:
> Jeffrey Yaskin posted a candidate design, implemented for filter_iterator,
> here:
> What do you think about this design?

That's beautiful!

My solution to the temporary range problem is simpler, but as
mentioned in Jeffrey's patch to the docs, for ranges that store an
iterator pair it wastes the space of a reference member in the lvalue
case, and doesn't vanish to nothing in C++03 mode:

template<typename R>
class adaptor
  R r; // R is a range or an lvalue-reference-to-range

  adaptor(R&& r) : r(std::forward<R>(r)) { }

  // ...

template<typename R>
adapted(R&& r)
{ return adaptor<R>{std::forward<R>(r)}; }

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