Experimental class to co_await on a bunch of awaitable objects, resuming when the first one completes. On completion, returns a result object that contains the index of the awaitable that finished first. A user can call result::index() and result::get<N>() on the result object to get the result, similar to std::variant.  
 More...
#include <coro/when_any.h>
template<typename... Args>
class dpp::when_any< Args >
Experimental class to co_await on a bunch of awaitable objects, resuming when the first one completes. On completion, returns a result object that contains the index of the awaitable that finished first. A user can call result::index() and result::get<N>() on the result object to get the result, similar to std::variant. 
- See also
- when_any::result 
- Template Parameters
- 
  
    | Args... | Type of each awaitable to await on |  
 
◆ when_any() [1/4]
template<typename... Args> 
 
Default constructor. A when_any object created this way holds no state. 
 
 
◆ when_any() [2/4]
template<typename... Args> 
template<typename... Args_> 
 
Constructor from awaitable objects. Each awaitable is executed immediately and the when_any object can then be co_await-ed later. 
- Exceptions
- 
  
    | ??? | Any exception thrown by the start of each awaitable will propagate to the caller. |  
 
- Parameters
- 
  
    | args | Arguments to construct each awaitable from. The when_any object will construct an awaitable for each, it is recommended to pass rvalues or std::move. |  
 
 
 
◆ when_any() [3/4]
template<typename... Args> 
 
This object is not copyable. 
 
 
◆ when_any() [4/4]
template<typename... Args> 
 
 
◆ ~when_any()
template<typename... Args> 
 
On destruction the when_any will try to call dpp::task::cancel() cancel() on each of its awaitable if they have such a method. 
- Note
- If you are looking to use a custom type with when_any and want it to cancel on its destruction, make sure it has a cancel() method, which will trigger an await_resume() throwing a dpp::task_cancelled_exception. This object will swallow the exception and return cleanly. Any other exception will be thrown back to the resumer. 
 
 
◆ await_ready()
template<typename... Args> 
 
Check whether a call to co_await would suspend. 
- Note
- This can change from false to true at any point, but not the other way around. 
- Returns
- bool Whether co_await would suspend 
 
 
◆ operator co_await()
template<typename... Args> 
 
Suspend the caller until any of the awaitables completes. 
- See also
- result 
- Exceptions
- 
  
    | ??? | On resumption, throws any exception caused by the construction of the result. |  
 
- Returns
- result On resumption, this object returns an object that allows to retrieve the index and result of the awaitable. 
 
 
◆ operator=() [1/2]
template<typename... Args> 
 
This object is not copyable. 
 
 
◆ operator=() [2/2]
template<typename... Args> 
 
Move assignment operator.