std::generator<Ref,V,Allocator>::iterator - cppreference.com (original) (raw)
| class /*iterator*/; | | (exposition only*) | | --------------------- | | ------------------- |
The return type of generator::begin. Models indirectly_readable and input_iterator.
Contents
- 1 Member types
- 2 Data members
- 3 Member functions
- 4 std::generator::iterator::iterator
- 5 std::generator::iterator::operator=
- 6 std::generator::iterator::operator*
- 7 std::generator::iterator::operator++
- 8 operator==(std::generator::iterator)
[edit] Member types
[edit] Data members
| Member | Description |
|---|---|
| std::coroutine_handlestd::generator::promise\_type\ coroutine_ | The coroutine handle(exposition-only member object*) |
[edit] Member functions
std::generator::iterator::iterator
| /*iterator*/( /*iterator*/&& other ) noexcept; | | (since C++23) | | -------------------------------------------------- | | ------------- |
Initializes _[coroutine](iterator.html#coroutine)_ with std::exchange(other.coroutine_, {});.
std::generator::iterator::operator=
| /*iterator*/& operator=( /*iterator*/&& other ) noexcept; | | (since C++23) | | -------------------------------------------------------------- | | ------------- |
Equivalent to coroutine_ = std::exchange(other.coroutine_, {});.
Returns: *this.
std::generator::iterator::operator*
- Let reference be the std::generator's underlying type.
- Let for some generator object x its
_[coroutine](iterator.html#coroutine)_be in the stack *x.active_. - Let x.active_->top() refer to a suspended coroutine with promise object p.
Equivalent to return static_cast<reference>(*p.value_);.
std::generator::iterator::operator++
| constexpr /*iterator*/& operator++(); | (1) | (since C++23) |
|---|---|---|
| constexpr void operator++( int ); | (2) | (since C++23) |
- Let for some generator object x the
_[coroutine](iterator.html#coroutine)_be in the stack *x.active_.
Equivalent to x.active_->top().resume().
Returns: *this.
- Equivalent to ++*this;.
[edit] Non-member functions
| | compares the underlying iterator with a sentinel (function) | | -------------------------------------------------------------- |
operator==(std::generator::iterator)
Equivalent to return i.coroutine_.done();.
The != operator is synthesized from operator==.
This function is not visible to ordinary unqualified or qualified lookup, and can only be found by argument-dependent lookup when std::generator::_iterator_ is an associated class of the arguments.