hpx/pack_traversal/pack_traversal_async.hpp#

See Public API for a list of names and headers that are part of the public HPX API.

namespace hpx
namespace util

Functions

template<typename Visitor, typename ...T>
auto traverse_pack_async(Visitor &&visitor, T&&... pack) -> decltype(detail::apply_pack_transform_async(HPX_FORWARD(Visitor, visitor), HPX_FORWARD(T, pack)...))#

Traverses the pack with the given visitor in an asynchronous way.

This function works in the same way as traverse_pack, however, we are able to suspend and continue the traversal at later time. Thus we require a visitor callable object which provides three operator() overloads as depicted by the code sample below:

struct my_async_visitor
{
    template <typename T>
    bool operator()(async_traverse_visit_tag, T&& element)
    {
        return true;
    }

    template <typename T, typename N>
    void operator()(async_traverse_detach_tag, T&& element, N&& next)
    {
    }

    template <typename T>
    void operator()(async_traverse_complete_tag, T&& pack)
    {
    }
};

See traverse_pack for a detailed description about the traversal behavior and capabilities.

Parameters
  • visitor – A visitor object which provides the three operator() overloads that were described above. Additionally the visitor must be compatible for referencing it from a hpx::intrusive_ptr. The visitor should must have a virtual destructor!

  • pack – The arbitrary parameter pack which is traversed asynchronously. Nested objects inside containers and tuple like types are traversed recursively.

Returns

A hpx::intrusive_ptr that references an instance of the given visitor object.

template<typename Allocator, typename Visitor, typename ...T>
auto traverse_pack_async_allocator(Allocator const &alloc, Visitor &&visitor, T&&... pack) -> decltype(detail::apply_pack_transform_async_allocator(alloc, HPX_FORWARD(Visitor, visitor), HPX_FORWARD(T, pack)...))#

Traverses the pack with the given visitor in an asynchronous way.

This function works in the same way as traverse_pack, however, we are able to suspend and continue the traversal at later time. Thus we require a visitor callable object which provides three operator() overloads as depicted by the code sample below:

struct my_async_visitor
{
    template <typename T>
    bool operator()(async_traverse_visit_tag, T&& element)
    {
        return true;
    }

    template <typename T, typename N>
    void operator()(async_traverse_detach_tag, T&& element, N&& next)
    {
    }

    template <typename T>
    void operator()(async_traverse_complete_tag, T&& pack)
    {
    }
};

See traverse_pack for a detailed description about the traversal behavior and capabilities.

Parameters
  • visitor – A visitor object which provides the three operator() overloads that were described above. Additionally the visitor must be compatible for referencing it from a hpx::intrusive_ptr. The visitor should must have a virtual destructor!

  • pack – The arbitrary parameter pack which is traversed asynchronously. Nested objects inside containers and tuple like types are traversed recursively.

  • alloc – Allocator instance to use to create the traversal frame.

Returns

A hpx::intrusive_ptr that references an instance of the given visitor object.