FiberSim
|
A helper class to facilitate waiting for and/or getting the results of multiple futures at once. More...
#include <BS_thread_pool.hpp>
Public Member Functions | |
multi_future (const size_t num_futures_=0) | |
Construct a multi_future object with the given number of futures. | |
std::conditional_t< std::is_void_v< T >, void, std::vector< T > > | get () |
Get the results from all the futures stored in this multi_future object, rethrowing any stored exceptions. | |
std::future< T > & | operator[] (const size_t i) |
Get a reference to one of the futures stored in this multi_future object. | |
void | push_back (std::future< T > future) |
Append a future to this multi_future object. | |
size_t | size () const |
Get the number of futures stored in this multi_future object. | |
void | wait () const |
Wait for all the futures stored in this multi_future object. | |
A helper class to facilitate waiting for and/or getting the results of multiple futures at once.
T | The return type of the futures. |
Construct a multi_future object with the given number of futures.
num_futures_ | The desired number of futures to store. |
|
inline |
Get the results from all the futures stored in this multi_future object, rethrowing any stored exceptions.
|
inline |
Get a reference to one of the futures stored in this multi_future object.
i | The index of the desired future. |
Append a future to this multi_future object.
future | The future to append. |
|
inline |
Get the number of futures stored in this multi_future object.