|
CeresEngine 0.2.0
A game development framework
|
The promise type used to implement to coroutine. More...
Public Types | |
| using | Value = std::remove_reference_t< T > |
| The value type returned by the generator. | |
| using | Reference = std::conditional_t< std::is_reference_v< T >, T, T & > |
A reference of Value. | |
| using | Pointer = Value * |
A pointer of Value. | |
Public Member Functions | |
| Promise ()=default | |
| Creates a new promise object. | |
| Generator | get_return_object () noexcept |
Creates a new Generator object. | |
| constexpr suspend_always | initial_suspend () const noexcept |
| constexpr suspend_always | final_suspend () const noexcept |
| template<typename U = T, std::enable_if_t<!std::is_rvalue_reference< U >::value, int > = 0> | |
| suspend_always | yield_value (std::remove_reference_t< T > &aValue) noexcept |
| Yields a new value to the generator. | |
| template<typename U = T, std::enable_if_t<!std::is_rvalue_reference< U >::value &&!std::is_const_v< U >, int > = 0> | |
| suspend_always | yield_value (const std::remove_reference_t< T > &aValue) noexcept |
| Yields a new value to the generator. | |
| void | unhandled_exception () noexcept |
| A method called internally by the compiler when an exception is thrown in the coroutine. | |
| void | return_void () noexcept |
| A method called internally by the compiler when the coroutine successfully finishes. | |
| template<typename U > | |
| suspend_never | await_transform (U &&value)=delete |
| Don't allow any use of 'co_await' inside the generator coroutine. | |
| Reference | getValue () const noexcept |
| void | rethrow () |
| If an exception was thrown in the coroutine, rethrows it. | |
Private Attributes | |
| Pointer | mValue = nullptr |
| The value returned by the last continuation of the coroutine. | |
| std::exception_ptr | mException = nullptr |
| The exception throw by the coroutine. | |
The promise type used to implement to coroutine.
A pointer of Value.
| using CeresEngine::Generator< T >::Promise::Reference = std::conditional_t<std::is_reference_v<T>, T, T&> |
A reference of Value.
| using CeresEngine::Generator< T >::Promise::Value = std::remove_reference_t<T> |
The value type returned by the generator.
|
default |
Creates a new promise object.
|
delete |
Don't allow any use of 'co_await' inside the generator coroutine.
| U | the value type awaited |
| value | The value awaited |
suspend_never
|
inlineconstexprnoexcept |
suspend_always
|
inlinenoexcept |
Creates a new Generator object.
This is caled internally by the compiler when creating a new generator.
|
inlinenoexcept |
|
inlineconstexprnoexcept |
suspend_always
|
inline |
If an exception was thrown in the coroutine, rethrows it.
If no exception was thrown, this method does nothing.
|
inlinenoexcept |
A method called internally by the compiler when the coroutine successfully finishes.
|
inlinenoexcept |
A method called internally by the compiler when an exception is thrown in the coroutine.
This will setup the execption to that it is thrown when calling operator++.
|
inlinenoexcept |
Yields a new value to the generator.
| U | the value type |
| aValue | The value to be yielded to the generator |
suspend_always
|
inlinenoexcept |
Yields a new value to the generator.
| U | the value type |
| aValue | The value to be yielded to the generator |
suspend_always
|
private |
The exception throw by the coroutine.
If no exception was thrown, this is ´nullptr`.
The value returned by the last continuation of the coroutine.