D++ (DPP)
C++ Discord API Bot Library
dpp::detail::task::promise_t< R > Struct Template Reference

A task's promise_t type, with special logic for handling nested tasks. More...

+ Collaboration diagram for dpp::detail::task::promise_t< R >:

Public Member Functions

 ~promise_t ()
 Destructor. Destroys the value if it was constructed. More...
 
void return_value (R &&expr) noexcept(std::is_nothrow_move_constructible_v< R >) requires std
 Function called by the standard library when the coroutine co_returns a value. More...
 
dpp::task< R > get_return_object () noexcept
 Function called by the standard library when the coroutine is created. More...
 
final_awaiter< R > final_suspend () const noexcept
 Function called by the standard library when the coroutine reaches its last suspension point. More...
 

Public Attributes

std::array< std::byte, sizeof(R)> result_storage
 Stored return value of the coroutine. More...
 

Detailed Description

template<typename R>
struct dpp::detail::task::promise_t< R >

A task's promise_t type, with special logic for handling nested tasks.

Implementation of task::promise_t for non-void return type.

Template Parameters
RReturn type of the task

Constructor & Destructor Documentation

◆ ~promise_t()

template<typename R >
dpp::detail::task::promise_t< R >::~promise_t ( )
inline

Destructor. Destroys the value if it was constructed.

Member Function Documentation

◆ final_suspend()

template<typename R >
final_awaiter<R> dpp::detail::task::promise_t< R >::final_suspend ( ) const
inlinenoexcept

Function called by the standard library when the coroutine reaches its last suspension point.

Returns
final_awaiter Special object containing the chain resolution and clean-up logic.

◆ get_return_object()

template<typename R >
dpp::task<R> dpp::detail::task::promise_t< R >::get_return_object ( )
inlinenoexcept

Function called by the standard library when the coroutine is created.

Returns
dpp::task The coroutine object

◆ return_value()

template<typename R >
void dpp::detail::task::promise_t< R >::return_value ( R &&  expr)
inlinenoexcept

Function called by the standard library when the coroutine co_returns a value.

Stores the value internally to hand to the caller when it resumes.

Parameters
exprThe value given to co_return

Function called by the standard library when the coroutine co_returns a value.

Stores the value internally to hand to the caller when it resumes.

Parameters
exprThe value given to co_return

Function called by the standard library when the coroutine co_returns a value.

Stores the value internally to hand to the caller when it resumes.

Parameters
exprThe value given to co_return

Member Data Documentation

◆ result_storage

template<typename R >
std::array<std::byte, sizeof(R)> dpp::detail::task::promise_t< R >::result_storage

Stored return value of the coroutine.

D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0