Boost logo

Boost :

Subject: Re: [boost] [range] fat iterators?
From: TONGARI J (tongari95_at_[hidden])
Date: 2013-11-09 08:37:01

2013/11/9 Eric Niebler <eniebler_at_[hidden]>

> I'm not sure what problem you're solving with 2-phase construction of
> ranges. Can you clarify?

The point is that your proposed approach would store state in the range
object, say, "mutable T obj_;" in istream_range, and the setup
is performed only at construction, which makes it infeasible for reentrance.

If someone do this:

    auto&& rng = istream_range<int>(std::cin) | filtered(...);
    copy(rng, a);
    copy(rng, b); // wrong result, internal 'next' not called

This is a bit contrived, and I'm not sure if there would be more
range/adaptor which have state...
Maybe the idea of 2-phase construction is just an oversight, and it won't
play with range-based for loop :/

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