Boost logo

Boost :

Subject: Re: [boost] [coroutine] interface suggestion
From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2012-09-20 09:39:03


On Thu, Sep 20, 2012 at 7:19 AM, Oliver Kowalke <oliver.kowalke_at_[hidden]>wrote:

>
> I agree that generator<> could get an iterator interface (output-iterator
> fro caller generator, input-iterator in generator<>-fn)
> But I'm not convinced that the coroutine<> template should have an
> iterator interface. How does the syntax look like for coroutine-fn with
> multiple parameters (for instance f() in the example above)?
>

you either enable the iterator interface for only coroutine<T()> and
coroutine<void(T)>, or, for muliple parameters, you make the value type a
tuple:

static_assert(is_same<range_value<coroutine<void(int, double, float)> >,
std::tuple<int, double, float>);

The only coroutines left out from the range interface are general
bidirecitonal coroutines of the form coroutine<T...>(T2...)>.

-- gpd


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk