
Oliver Kowalke wrote
BTW, I understand that the following coroutine returns twice, but it is a little bit obscure, as there are two ways to return a value from a coroutine.
int f( coro_ref::self_t & self, int a) { return self.yield( a); }
LUA follows the same schema, but I don't share it. I you adopt the same design as generators there will be no possible confusion. Only one way to yield a value.
What do others think?
It is possible to implement it but I've concerns because the coroutine-fn has another signature/return type as the signature given to coroutine as template argument. It might confuse users.
typedef coroutine< int( int) > coro_t;
void fn( coro_t::self_t&, int) {...}
Does the current implementation check at compile time that the return type of the coroutine function is the one of the signature?
Sorry. I believed you had reached to mix them. Maybe you could reach to make a StackAllocator model a standard allocator just by renaming the stack allocator functions.
standard-allocator requires functions like deallocate/destory allocate/create.
stack-allocators do not construct objects the allocate/deallocate only memory chunks. I believe those are two different concepts (beside the special requirements of stack-allocators on the return address of the allocated chunk).
Yes. It is a bad idea to mix them. I don't remember if you plan to add standard allocator or not. Could you confirm? Best, Vicente -- View this message in context: http://boost.2283326.n4.nabble.com/Review-Coroutine-More-comments-questions-... Sent from the Boost - Dev mailing list archive at Nabble.com.