D++ (DPP)
C++ Discord API Bot Library
dpp::when_any< Args >::result Class Reference

Object returned by operator co_await() on resumption. Can be moved but not copied. More...

#include <when_any.h>

Public Member Functions

 result (result &&)=default
 Move constructor. More...
 
 result (const result &)=delete
 This object is not copyable. More...
 
resultoperator= (result &&)=default
 Move assignment operator. More...
 
resultoperator= (const result &)=delete
 This object is not copyable. More...
 
size_t index () const noexcept
 Retrieve the index of the awaitable that finished first. More...
 
template<size_t N>
result_t< N > & get () &
 Retrieve the non-void result of an awaitable. More...
 
template<size_t N>
const result_t< N > & get () const &
 Retrieve the non-void result of an awaitable. More...
 
template<size_t N>
result_t< N > && get () &&
 Retrieve the non-void result of an awaitable. More...
 
template<size_t N>
requires (detail::when_any::void_result<result_t<N>>)
void get ()=delete
 Cannot retrieve a void result. More...
 
bool is_exception () const noexcept
 Checks whether the return of the first awaitable triggered an exception, that is, a call to get() will rethrow. More...
 

Friends

class when_any< Args... >
 

Detailed Description

template<typename... Args>
class dpp::when_any< Args >::result

Object returned by operator co_await() on resumption. Can be moved but not copied.

Constructor & Destructor Documentation

◆ result() [1/2]

template<typename... Args>
dpp::when_any< Args >::result::result ( result &&  )
default

Move constructor.

◆ result() [2/2]

template<typename... Args>
dpp::when_any< Args >::result::result ( const result )
delete

This object is not copyable.

Member Function Documentation

◆ get() [1/4]

template<typename... Args>
template<size_t N>
result_t< N > & dpp::when_any< Args >::result::get ( ) &
inline

Retrieve the non-void result of an awaitable.

Template Parameters
NIndex of the result to retrieve. Must correspond to index().
Exceptions
???Throws any exception triggered at construction, or std::bad_variant_access if N does not correspond to index()
Returns
Result of the awaitable as a reference.

◆ get() [2/4]

template<typename... Args>
template<size_t N>
result_t< N > && dpp::when_any< Args >::result::get ( ) &&
inline

Retrieve the non-void result of an awaitable.

Template Parameters
NIndex of the result to retrieve. Must correspond to index().
Exceptions
???Throws any exception triggered at construction, or std::bad_variant_access if N does not correspond to index()
Returns
Result of the awaitable as an rvalue reference.

◆ get() [3/4]

template<typename... Args>
template<size_t N>
const result_t< N > & dpp::when_any< Args >::result::get ( ) const &
inline

Retrieve the non-void result of an awaitable.

Template Parameters
NIndex of the result to retrieve. Must correspond to index().
Exceptions
???Throws any exception triggered at construction, or std::bad_variant_access if N does not correspond to index()
Returns
Result of the awaitable as a cpnst reference.

◆ get() [4/4]

template<typename... Args>
template<size_t N>
requires (detail::when_any::void_result<result_t<N>>)
void dpp::when_any< Args >::result::get ( )
delete

Cannot retrieve a void result.

◆ index()

template<typename... Args>
size_t dpp::when_any< Args >::result::index ( ) const
inlinenoexcept

Retrieve the index of the awaitable that finished first.

Returns
size_t Index of the awaitable that finished first, relative to the template arguments of when_any

◆ is_exception()

template<typename... Args>
bool dpp::when_any< Args >::result::is_exception ( ) const
inlinenoexcept

Checks whether the return of the first awaitable triggered an exception, that is, a call to get() will rethrow.

Returns
Whether or not the result is an exception

◆ operator=() [1/2]

template<typename... Args>
result & dpp::when_any< Args >::result::operator= ( const result )
delete

This object is not copyable.

◆ operator=() [2/2]

template<typename... Args>
result & dpp::when_any< Args >::result::operator= ( result &&  )
default

Move assignment operator.

Friends And Related Function Documentation

◆ when_any< Args... >

template<typename... Args>
friend class when_any< Args... >
friend
D++ Library version 10.0.34D++ Library version 10.0.33D++ Library version 10.0.32D++ Library version 10.0.31D++ Library version 10.0.30D++ Library version 10.0.29D++ Library version 10.0.28D++ Library version 10.0.27D++ Library version 10.0.26D++ Library version 10.0.25D++ Library version 10.0.24D++ Library version 10.0.23D++ Library version 10.0.22D++ Library version 10.0.21D++ Library version 10.0.20D++ Library version 10.0.19D++ Library version 10.0.18D++ Library version 10.0.17D++ Library version 10.0.16D++ Library version 10.0.15D++ Library version 10.0.14D++ Library version 10.0.13D++ Library version 10.0.12D++ Library version 10.0.11D++ Library version 10.0.10D++ Library version 10.0.9D++ Library version 10.0.8D++ Library version 10.0.7D++ Library version 10.0.6D++ Library version 10.0.5D++ Library version 10.0.4D++ Library version 10.0.3D++ Library version 10.0.2D++ Library version 10.0.1D++ Library version 10.0.0D++ Library version 9.0.19D++ Library version 9.0.18D++ Library version 9.0.17D++ Library version 9.0.16D++ Library version 9.0.15D++ Library version 9.0.14D++ 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