hpx::functional::unwrap, hpx::functional::unwrap_n, hpx::functional::unwrap_all, hpx::unwrap, hpx::unwrap_n, hpx::unwrap_all, hpx::unwrapping, hpx::unwrapping_n, hpx::unwrapping_all#

Defined in header hpx/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>
auto 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> -> 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.

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.

template<std::size_t Depth, typename ...Args>
auto unwrap_n(Args&&... args) -> decltype(util::detail::unwrap_depth_impl<Depth>(HPX_FORWARD(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>
auto unwrap_all(Args&&... args) -> decltype(util::detail::unwrap_depth_impl<0U>(HPX_FORWARD(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>
auto unwrapping(T &&callable) -> decltype(util::detail::functional_unwrap_depth_impl<1U>(HPX_FORWARD(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.

    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.

template<std::size_t Depth, typename T>
auto unwrapping_n(T &&callable) -> decltype(util::detail::functional_unwrap_depth_impl<Depth>(HPX_FORWARD(T, callable)))#

Returns a callable object which unwraps its arguments upon invocation using the hpx::unwrap_n() function and then passes the result to the given callable object.

See hpx::unwrapping() for a detailed description.

template<typename T>
auto unwrapping_all(T &&callable) -> decltype(util::detail::functional_unwrap_depth_impl<0U>(HPX_FORWARD(T, callable)))#

Returns a callable object which unwraps its arguments upon invocation using the hpx::unwrap_all() function and then passes the result to the given callable object.

See hpx::unwrapping() for a detailed description.

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.

template<std::size_t Depth>
struct unwrap_n#
#include <unwrap.hpp>

A helper function object for functionally invoking hpx::unwrap_n. For more information please refer to its documentation.