A helper class to facilitate waiting for and/or getting the results of multiple futures at once.
More...
#include <BS_thread_pool.hpp>
template<typename T>
class BS::multi_future< T >
A helper class to facilitate waiting for and/or getting the results of multiple futures at once.
- Template Parameters
-
T | The return type of the futures. |
◆ multi_future()
Construct a multi_future object with the given number of futures.
- Parameters
-
num_futures_ | The desired number of futures to store. |
◆ get()
std::conditional_t<std::is_void_v<T>, void, std::vector<T> > get |
( |
| ) |
|
|
inline |
Get the results from all the futures stored in this multi_future object, rethrowing any stored exceptions.
- Returns
- If the futures return void, this function returns void as well. Otherwise, it returns a vector containing the results.
◆ operator[]()
std::future<T>& operator[] |
( |
const size_t |
i | ) |
|
|
inline |
Get a reference to one of the futures stored in this multi_future object.
- Parameters
-
i | The index of the desired future. |
- Returns
- The future.
◆ push_back()
void push_back |
( |
std::future< T > |
future | ) |
|
|
inline |
Append a future to this multi_future object.
- Parameters
-
future | The future to append. |
◆ size()
Get the number of futures stored in this multi_future object.
- Returns
- The number of futures.
The documentation for this class was generated from the following file: