HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Types | Public Member Functions
v1::detail::when_any< Ts > Class Template Reference

#include <hikogui/dispatch/when_any.hpp>

Public Types

using value_type = std::variant<variant_decay_t<await_resume_result_t<Ts>>...>
 

Public Member Functions

 when_any (Ts const &...args) noexcept
 Construct a when_any object from the given awaitables.
 
 when_any (when_any &&)=delete
 
 when_any (when_any const &)=delete
 
when_anyoperator= (when_any &&)=delete
 
when_anyoperator= (when_any const &)=delete
 
constexpr bool await_ready () noexcept
 
void await_suspend (std::coroutine_handle<> const &handle) noexcept
 
value_type await_resume () noexcept
 

Detailed Description

template<awaitable... Ts>
class v1::detail::when_any< Ts >

An awaitable that waits for any of the given awaitables to complete.

The return value of awaiting on when_any is a std::variant of the return values of the given awaitables. If an awaitable has void as return type then it will be converted to a std::monotype so that is can be used in the std::variant.

The index() of the std::variant return type will match the index of the when_any() constructor argument of the triggered awaitable.

Template Parameters
TsAwaitable types.

Constructor & Destructor Documentation

◆ when_any()

template<awaitable... Ts>
v1::detail::when_any< Ts >::when_any ( Ts const &... args)
inlinenoexcept

Construct a when_any object from the given awaitables.

The arguments may be of the following types:

  • An object which can be directly used as an awaitable. Having the member functions: await_ready(), await_suspend() and await_resume().
  • An object that has a operator co_await() member function.
  • An object that has a operator co_await() free function.
  • An object that can be converted using the awaitable_cast functor.
Parameters
othersThe awaitable to wait for.

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