std::generator<Ref,V,Allocator>::iterator
From cppreference.com
class /*iterator*/; |
(説明用*) | |
generator::beginの戻り値の型です。indirectly_readableおよびinput_iteratorをモデル化します。
目次 |
[編集] メンバ型
| メンバ型 | 定義 |
value_type
|
std::generator::value
|
difference_type
|
std::ptrdiff_t |
[編集] データメンバ
| メンバ | 説明 |
std::coroutine_handle<std::generator::promise_type> coroutine_ |
コルーチンハンドル (説明用のメンバオブジェクト*) |
[編集] メンバ関数
| イテレータを構築する (public member function) | |
| 別のイテレータを代入します (public member function) | |
| 基底となる値を返します (public member function) | |
| イテレータを進める (public member function) |
std::generator::iterator::iterator
| /*iterator*/( /*iterator*/&& other ) noexcept; |
(C++23から) | |
coroutine_をstd::exchange(other.coroutine_, {});で初期化します。
std::generator::iterator::operator=
| /*iterator*/& operator=( /*iterator*/&& other ) noexcept; |
(C++23から) | |
coroutine_ = std::exchange(other.coroutine_, {});と同等です。
戻り値:*this。
std::generator::iterator::operator*
| reference operator*() const noexcept( std::is_nothrow_copy_constructible_v<reference> ); |
(C++23から) | |
referenceはstd::generatorの基底となる型とします。- あるジェネレータオブジェクトxについて、その
coroutine_がスタック*x.active_にあるとします。 - x.active_->top()がプロミスオブジェクトpを持つ中断されたコルーチンを参照するとします。
return static_cast<reference>(*p.value_);と同等です。
std::generator::iterator::operator++
| constexpr /*iterator*/& operator++(); |
(1) | (C++23から) |
| constexpr void operator++( int ); |
(2) | (C++23から) |
x.active_->top().resume()と同等です。
戻り値:*this。
2) ++*this;と同等です。
[編集] 非メンバ関数
| (C++23) |
基底となるイテレータをセンチネルと比較します (関数) |
operator==(std::generator::iterator)
| friend bool operator==( const /*iterator*/& i, std::default_sentinel_t ); |
(C++23から) | |
return i.coroutine_.done();と同等です。
!= 演算子は operator== から合成される。
この関数は、通常の非修飾または修飾ルックアップからは見えず、std::generator::iteratorが引数に関連付けられたクラスである場合にのみ、引数依存ルックアップによって見つけることができます。
[編集] 使用例
| このセクションは未完成です 理由: 例がありません |