How about adding a new coroutine type co_resource<T>? vector's blog post co_resource<T>: An RAII coroutine Implementation of co_resource<T> in neo_fun