D++ (DPP)
C++ Discord API Bot Library
dpp::coroutine Class Reference

Base type for a coroutine, starts on co_await. More...

Public Types

using result_type = R
 The type of the result produced by this coroutine. More...
 

Public Member Functions

 coroutine ()=default
 Default constructor, creates an empty coroutine. More...
 
 coroutine (const coroutine &)=delete
 Copy constructor is disabled. More...
 
 coroutine (coroutine &&other) noexcept
 Move constructor, grabs another coroutine's handle. More...
 
 ~coroutine ()
 Destructor, destroys the handle. More...
 
coroutineoperator= (const coroutine &)=delete
 Copy assignment is disabled. More...
 
coroutineoperator= (coroutine &&other) noexcept
 Move assignment, grabs another coroutine's handle. More...
 
auto operator co_await ()
 

Friends

struct detail::coroutine::promise_t< R >
 Promise has friend access for the constructor. More...
 

Detailed Description

Base type for a coroutine, starts on co_await.

Warning
- This feature is EXPERIMENTAL. The API may change at any time and there may be bugs. Please report any to GitHub Issues or to our Discord Server.
- Using co_await on this object more than once is undefined behavior.
Template Parameters
RReturn type of the coroutine. Can be void, or a complete object that supports move construction and move assignment.

Member Typedef Documentation

◆ result_type

The type of the result produced by this coroutine.

Constructor & Destructor Documentation

◆ coroutine() [1/3]

dpp::coroutine::coroutine ( )
default

Default constructor, creates an empty coroutine.

◆ coroutine() [2/3]

dpp::coroutine::coroutine ( const coroutine )
delete

Copy constructor is disabled.

◆ coroutine() [3/3]

dpp::coroutine::coroutine ( coroutine &&  other)
inlinenoexcept

Move constructor, grabs another coroutine's handle.

Parameters
otherCoroutine to move the handle from

◆ ~coroutine()

dpp::coroutine::~coroutine ( )
inline

Destructor, destroys the handle.

Member Function Documentation

◆ operator co_await()

auto dpp::coroutine::operator co_await ( )
inline

◆ operator=() [1/2]

coroutine& dpp::coroutine::operator= ( const coroutine )
delete

Copy assignment is disabled.

◆ operator=() [2/2]

coroutine& dpp::coroutine::operator= ( coroutine &&  other)
inlinenoexcept

Move assignment, grabs another coroutine's handle.

Parameters
otherCoroutine to move the handle from

Friends And Related Function Documentation

◆ detail::coroutine::promise_t< R >

friend struct detail::coroutine::promise_t< R >
friend

Promise has friend access for the constructor.

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