Boost logo

Boost :

Subject: Re: [boost] {Review] Coroutine reviewstarts today, September 3rd
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2012-09-11 16:20:29


Am 11.09.2012 17:43, schrieb Eugene Yakubovich:
>>> Maybe we can change behavior so that generator's constructor does not
>>> invoke the generator-function, only operator() does. And change
>>> operator() to return optional<R> instead of R. The usage can then be:
>>>
>>> gen_t g(foo);
>>> while( optional<X> val = g() ) {
>>> // use val.get()
>>> }
>> what would be the benefit?
>>
> This would eliminate the "early destruction" problem described before.
> The generator would end up not storing a value (which it currently
> does in detail::generator_resume::result_) and operator() would just
> return whatever the generator-function yielded or optional<none> if
> the generator-function exited.
>
changed in git-repo

regards,
Oliver


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