Namespaces
Variants

std::generator<Ref,V,Allocator>:: ~generator

From cppreference.net
Utilities library
Coroutine support
Coroutine traits
Coroutine handle
No-op coroutines
Trivial awaitables
Range generators
(C++23)
Ranges library
Range adaptors
~generator ( ) ;
(C++23부터)

생성기 객체를 소멸합니다.

주어진 coroutine_ 가 기본 코루틴 객체일 때, 다음 코드와 동등합니다:

if (coroutine_)
    coroutine_.destroy();

참고로, 루트 제너레이터를 파괴하면 전체 yield된 제너레이터 스택이 효과적으로 파괴됩니다. 왜냐하면 재귀적으로 yield된 제너레이터의 소유권이 yielding 제너레이터의 코루틴 프레임 내 awaitable 객체에 보유되기 때문입니다.

복잡도

예제