xentara-utils v1.2.1
Xentara utilities library
Loading...
Searching...
No Matches
xentara::utils::coro::Generator< Type >::Iterator Class Referencefinal

#include <coro/Generator.hpp>

Public Types

using value_type = std::remove_reference_t< Type >
 The value type.
 
using difference_type = std::ptrdiff_t
 Dummy type for non-existend difference type.
 
using reference = std::add_lvalue_reference_t< Type >
 A reference to a value.
 
using pointer = std::add_pointer_t< Type >
 A pointer to a value.
 
using iterator_concept = std::input_iterator_tag
 The iterator concept.
 
using iterator_category = iterator_concept
 The iterator category, for use in pre-C++20 code.
 

Public Member Functions

 Iterator () noexcept=default
 Default constructor.
 
 Iterator (std::default_sentinel_t) noexcept
 Conversion constructor for a sentinel.
 
auto operator== (const Iterator &rhs) const -> bool
 Equality operator.
 
auto operator++ () -> Iterator &
 Pre-increment operator.
 
auto operator++ (int) -> Iterator
 Post-increment operator.
 
auto operator* () noexcept -> reference
 Indirection operator.
 
auto operator-> () noexcept -> pointer
 Member access operator.
 

Member Typedef Documentation

◆ difference_type

template<typename Type >
using xentara::utils::coro::Generator< Type >::Iterator::difference_type = std::ptrdiff_t

Dummy type for non-existend difference type.

◆ iterator_category

template<typename Type >
using xentara::utils::coro::Generator< Type >::Iterator::iterator_category = iterator_concept

The iterator category, for use in pre-C++20 code.

◆ iterator_concept

template<typename Type >
using xentara::utils::coro::Generator< Type >::Iterator::iterator_concept = std::input_iterator_tag

The iterator concept.

◆ pointer

template<typename Type >
using xentara::utils::coro::Generator< Type >::Iterator::pointer = std::add_pointer_t<Type>

A pointer to a value.

◆ reference

template<typename Type >
using xentara::utils::coro::Generator< Type >::Iterator::reference = std::add_lvalue_reference_t<Type>

A reference to a value.

◆ value_type

template<typename Type >
using xentara::utils::coro::Generator< Type >::Iterator::value_type = std::remove_reference_t<Type>

The value type.

Constructor & Destructor Documentation

◆ Iterator() [1/2]

template<typename Type >
xentara::utils::coro::Generator< Type >::Iterator::Iterator ( )
defaultnoexcept

Default constructor.

This constructor creates an invalid iterator. It is suitable as a sentinel for algorithms that require the sentinel to be of the same type as the iterator.

◆ Iterator() [2/2]

template<typename Type >
xentara::utils::coro::Generator< Type >::Iterator::Iterator ( std::default_sentinel_t  )
noexcept

Conversion constructor for a sentinel.

This constructor creates an invalid iterator suitable for use as a sentinel for algorithms that require the sentinel to be of the same type as the iterator.

Member Function Documentation

◆ operator*()

template<typename Type >
auto xentara::utils::coro::Generator< Type >::Iterator::operator* ( ) -> reference
noexcept

Indirection operator.

Attention
Must not be called on the past-the-end iterator.
Returns
A reference to the member at the current position.

◆ operator++() [1/2]

template<typename Type >
auto xentara::utils::coro::Generator< Type >::Iterator::operator++ ( ) -> Iterator &

Pre-increment operator.

Moves the iterator forward by one position.

Attention
Must not be called on the past-the-end iterator.
Exceptions
...The generator raised an exception generating the next value

◆ operator++() [2/2]

template<typename Type >
auto xentara::utils::coro::Generator< Type >::Iterator::operator++ ( int  ) -> Iterator

Post-increment operator.

Moves the iterator forward by one position.

Attention
Must not be called on the past-the-end iterator.
Returns
An iterator containing the member pointed to before the call
Exceptions
...The generator raised an exception generating the next value

◆ operator->()

template<typename Type >
auto xentara::utils::coro::Generator< Type >::Iterator::operator-> ( ) -> pointer
noexcept

Member access operator.

Gives access to a class member of the object member at the current position.

Attention
Must not be called on the past-the-end iterator.

◆ operator==()

template<typename Type >
auto xentara::utils::coro::Generator< Type >::Iterator::operator== ( const Iterator rhs) const -> bool

Equality operator.