CXXIter 0.2
Loading...
Searching...
No Matches
CXXIter::Generator< T > Class Template Reference

Generator that C++20 coroutines passed to CXXIter::IterApi::generateFrom() have to return. This generator supports exceptions, co_yield for producing an arbitrary amount of elements, and can take references as results from coroutines - as long as they live long enough until used. More...

#include <Generator.h>

Collaboration diagram for CXXIter::Generator< T >:

Classes

struct  promise_type
 

Public Types

using value_type = T
 
using Handle = std::coroutine_handle< promise_type >
 

Public Member Functions

 Generator (const Handle coroutine)
 
 Generator (const Generator &)=delete
 
Generatoroperator= (const Generator &)=delete
 
 Generator (Generator &&other) noexcept
 
Generatoroperator= (Generator &&other) noexcept
 
IterValue< T > next ()
 

Detailed Description

template<typename T>
class CXXIter::Generator< T >

Generator that C++20 coroutines passed to CXXIter::IterApi::generateFrom() have to return. This generator supports exceptions, co_yield for producing an arbitrary amount of elements, and can take references as results from coroutines - as long as they live long enough until used.

Definition at line 21 of file Generator.h.

Member Typedef Documentation

◆ Handle

template<typename T >
using CXXIter::Generator< T >::Handle = std::coroutine_handle<promise_type>

Definition at line 25 of file Generator.h.

◆ value_type

template<typename T >
using CXXIter::Generator< T >::value_type = T

Definition at line 23 of file Generator.h.

Constructor & Destructor Documentation

◆ Generator() [1/2]

template<typename T >
CXXIter::Generator< T >::Generator ( const Handle  coroutine)
inlineexplicit

Definition at line 46 of file Generator.h.

◆ ~Generator()

template<typename T >
CXXIter::Generator< T >::~Generator ( )
inline

Definition at line 48 of file Generator.h.

◆ Generator() [2/2]

template<typename T >
CXXIter::Generator< T >::Generator ( Generator< T > &&  other)
inlinenoexcept

Definition at line 57 of file Generator.h.

Member Function Documentation

◆ next()

template<typename T >
IterValue< T > CXXIter::Generator< T >::next ( )
inline

Definition at line 66 of file Generator.h.

◆ operator=()

template<typename T >
Generator & CXXIter::Generator< T >::operator= ( Generator< T > &&  other)
inlinenoexcept

Definition at line 60 of file Generator.h.


The documentation for this class was generated from the following file: