hpx/pack_traversal/unwrap.hpp¶
See Public API for a list of names and headers that are part of the public HPX API.
-
namespace
hpx
Functions
-
template<typename ...
Args
>
autounwrap
(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>
->int
hpx::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.
// Single arguments int i1 = 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.
- Return
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.
- Parameters
args
: the arguments that are unwrapped which may contain any arbitrary future or non future type.
- Exceptions
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.
-
template<std::size_t
Depth
, typename ...Args
>
autounwrap_n
(Args&&... args)¶ An alterntive version of hpx::unwrap(), which unwraps the given arguments to a certain depth of hpx::future like objects.
See unwrap for a detailed description.
- Template Parameters
Depth
: The count of hpx::future like objects which are unwrapped maximally.
-
template<typename ...
Args
>
autounwrap_all
(Args&&... args)¶ An alterntive version of hpx::unwrap(), which unwraps the given arguments recursively so that all contained hpx::future like objects are replaced by their actual value.
See hpx::unwrap() for a detailed description.
-
template<typename
T
>
autounwrapping
(T &&callable)¶ Returns a callable object which unwraps its arguments upon invocation using the hpx::unwrap() function and then passes the result to the given callable object.
auto callable = hpx::unwrapping([](int left, int right) { return left + right; }); int i1 = callable(hpx::make_ready_future(1), hpx::make_ready_future(2));
See hpx::unwrap() for a detailed description.
- Parameters
callable
: the callable object which which is called with the result of the corresponding unwrap function.
-
namespace
functional
¶ -
struct
unwrap
¶ - #include <unwrap.hpp>
A helper function object for functionally invoking
hpx::unwrap
. For more information please refer to its documentation.
-
struct
unwrap_all
¶ - #include <unwrap.hpp>
A helper function object for functionally invoking
hpx::unwrap_all
. For more information please refer to its documentation.
-
struct
-
namespace
util
Functions
-
namespace
functional
Functions
-
struct hpx::util::functional::HPX_DEPRECATED_V(1, 7, "Please use hpx::functional::unwrap instead.")
-
-
namespace
-
template<typename ...