
7 Nov
2013
7 Nov
'13
8:49 p.m.
On 7 November 2013 17:27, Nathan Ridge wrote:
Jeffrey Yaskin posted a candidate design, implemented for filter_iterator, here: https://svn.boost.org/trac/boost/ticket/7630
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 public: explicit adaptor(R&& r) : r(std::forward<R>(r)) { } // ... }; template<typename R> adaptor<R> adapted(R&& r) { return adaptor<R>{std::forward<R>(r)}; }