|
Boost : |
Subject: Re: [boost] [coroutine] interface suggestion
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-09-19 14:12:29
Le 19/09/12 14:23, Oliver Kowalke a écrit :
> I forgot a suggestion made by Vicente:
>
> 5.a coroutine<>::caller_t provides function bind() which must be called
> after coroutine::caller_t::yield() returned in order to get the
> parameters
>
> int f( caller_t & c, strg & s, int x) {
> c.yield( 7); // alternative c( 7)
> c.bind( s, x); // s and x will contain new values given by caller
> }
My suggestion was to call bind just once at the beginning of function
and before any call to yield.
If you want to ensure that the bind has been done, you could request
that yield is provided by the result of the bind operation, as e.g.
int f( caller_t & c, strg & s, int x) {
auto b = c.bind( s, x); // s and x are now used to store the next calls.
b.yield( 7); // alternative b( 7)
// here s and x have been reassigned
}
Best,
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk