
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) {...}
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). Oliver