std::generator<Ref,V,Allocator>::generator - cppreference.com ([original](https://en.cppreference.com/w/cpp/coroutine/generator/generator.html)) (raw)

| ~generator(); | | (since C++23) | | -------------- | | ------------- |

Destructs the generator object.

Given coroutine_ as the underlying coroutine object, equivalent to:

if (coroutine_) coroutine_.destroy();

Note, that destroying the root generator effectively destroys the entire stack of yielded generators, because the ownership of recursively yielded generators is held in awaitable objects in the coroutine frame of the yielding generator.

[edit] Complexity

[edit] Example