xentara-utils v2.0.4
The Xentara Utility Library
Loading...
Searching...
No Matches
xentara::utils::coro::Generator< Type > Class Template Referencefinal

A coroutine handle suitable for generators. More...

#include <xentara/utils/coro/Generator.hpp>

+ Inheritance diagram for xentara::utils::coro::Generator< Type >:

Classes

class  Iterator
 The iterator type used to access the generated values. More...
 

Public Types

using promise_type = Promise
 The promise type for coroutines that return this type.
 

Public Member Functions

 Generator ()=delete
 This type is not user instantiable.
 
internal auto begin () -> Iterator
 Returns an object that can be used to iterate over the remaining members.
 
constexpr auto end () noexcept -> std::default_sentinel_t
 Returns an sentinel that can be used to determine if an iterator is exhausted.
 

Detailed Description

template<typename Type>
class xentara::utils::coro::Generator< Type >

A coroutine handle suitable for generators.

Template Parameters
TypeThe type of data to generate

Member Typedef Documentation

◆ promise_type

template<typename Type >
using xentara::utils::coro::Generator< Type >::promise_type = Promise

The promise type for coroutines that return this type.

Constructor & Destructor Documentation

◆ Generator()

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

This type is not user instantiable.

Member Function Documentation

◆ begin()

template<typename Type >
auto xentara::utils::coro::Generator< Type >::begin ( ) -> Iterator

Returns an object that can be used to iterate over the remaining members.

Returns
An iterator that allows reading of the members
Exceptions
...The generator raised an exception generating the first value

◆ end()

template<typename Type >
constexpr auto xentara::utils::coro::Generator< Type >::end ( ) -> std::default_sentinel_t
constexprnoexcept

Returns an sentinel that can be used to determine if an iterator is exhausted.

Returns
An sentinel for member iterators