|
Boost : |
Subject: Re: [boost] [coroutine][review] Very Late Review
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2012-09-19 17:03:57
Am 19.09.2012 18:18, schrieb Giovanni Piero Deretta:
> well, if I read your discussion with Vicente correctly,you are
> planning to add either a bind or a get method to self to bind
> parameters. For simmetry the same solution should be used for the
> coroutine itself, especially if I get to convince you to use the same
> class template for both the coroutine and the self object.
> by tweaking the implementation the coroutine_self type and the
> coroutine wouldn't need to share anything. HTH,
I'm uncertain if coroutine<> or self_t should be the first param of
coroutine-fn. At least I want to implement Vicente's idea of updating
the coroutine-fn parameters after each yield().
I believe your suggestion of passing a coroutine<> with 'inverted'
signature will not be compatible if the coroutine-fn has more than one
parameter. How would the signature of the coroutine (first parameter in
fn instead of self_t) look like?
maybe the first parameter is a factory?
typedef coroutine< int( int, string &) > coro_t;
int f( coro_t::self_t & self, int x, string & s) {
coroutine< ? > coro = self.bind( x, s);
// x == 3, s == "abc"
coro( 7);
// x == 11, s == "xyz"
reutnr -1;
}
coro_t coro( f);
int res = coro( 3, "abc");
res = coro( 11, "xyz");
I want to force the user to call bind() (memebr of some special class?)
to provide the address of the parameters
and return an object (coroutine<>?) used for yielding the coroutine-fn.
Oliver
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk