hpx::unwrap#
Defined in header hpx/unwrap.hpp.
See Public API for a list of names and headers that are part of the public HPX API.
See also:
-
template<typename ...Args>
auto hpx::unwrap(Args&&... args) -> decltype(util::detail::unwrap_depth_impl<1U>(HPX_FORWARD(Args, args)...))# A helper function for retrieving the actual result of any hpx::future like type which is wrapped in an arbitrary way.
Unwraps the given pack of arguments, so that any hpx::future object is replaced by its future result type in the argument pack:
hpx::future<int>->inthpx::future<std::vector<float>>->std::vector<float>std::vector<future<float>>->std::vector<float>
The function is capable of unwrapping hpx::future like objects that are wrapped inside any container or tuple like type, see hpx::util::map_pack() for a detailed description about which surrounding types are supported. Non hpx::future like types are permitted as arguments and passed through.
hpx:unwrap(hpx::make_ready_future(0)); // Multiple arguments hpx::tuple<int, int> i2 = hpx:unwrap(hpx::make_ready_future(1), hpx::make_ready_future(2));
Note
This function unwraps the given arguments until the first traversed nested hpx::future which corresponds to an unwrapping depth of one. See hpx::unwrap_n() for a function which unwraps the given arguments to a particular depth or hpx::unwrap_all() that unwraps all future like objects recursively which are contained in the arguments.
- Parameters
args – the arguments that are unwrapped which may contain any arbitrary future or non-future type.
- Throws
std::exception – like objects in case any of the given wrapped hpx::future objects were resolved through an exception. See hpx::future::get() for details.
- Returns
Depending on the count of arguments this function returns a hpx::tuple containing the unwrapped arguments if multiple arguments are given. In case the function is called with a single argument, the argument is unwrapped and returned.