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 ( const generator & ) = delete ;
(1) (自 C++23 起)
generator ( generator && other ) noexcept ;
(2) (自 C++23 起)

构造一个 generator

1) 复制构造函数被删除。
2) 用于初始化底层 coroutine_ 的移动构造函数,通过 std:: exchange ( other. coroutine_ , { } ) 实现,同时通过 std:: exchange ( other. active_ , nullptr ) 初始化底层协程句柄栈( active_ )。 需注意,先前从 other 获取的迭代器不会失效,但会转变为指向 * this 的迭代器。

参数

其他 - 待移入的生成器对象

示例