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

< cpp‎ | coroutine‎ | generator
generator( const generator& ) = delete;
(1) (C++23 起)
generator( generator&& other ) noexcept;
(2) (C++23 起)

构造 generator

1) 复制构造函数被弃置。
2) 移动构造函数使用 std::exchange(other.coroutine_, {}) 初始化底层的 coroutine_,以及用 std::exchange(other.active_, nullptr) 初始化协程句柄的底层栈 (active_)。 注意,此前来自 other 迭代器不会失效,而是成为 *this 的迭代器。

参数

other - 要被移入的协程对象。

示例