hpx::experimental::reduction_bit_xor#

Defined in header hpx/algorithm.hpp.

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

namespace hpx
namespace experimental

Top-level namespace.

Functions

template<typename T>
constexpr hpx::parallel::detail::reduction_helper<T, std::bit_xor<T>> reduction_bit_xor(T &var)#

The function template reduction_bit_xor returns a reduction object of unspecified type having a value type and encapsulating an identity value for the reduction, it uses std::bit_xor{} as its combiner function, and a live-out object from which the initial value is obtained and into which the final value is stored.

A parallel algorithm uses the reduction_bit_xor object by allocating an unspecified number of instances, called views, of the reduction’s value type. Each view is initialized with the reduction object’s identity value, except that the live-out object (which was initialized by the caller) comprises one of the views. The algorithm passes a reference to a view to each application of an element-access function, ensuring that no two concurrently-executing invocations share the same view. A view can be shared between two applications that do not execute concurrently, but initialization is performed only once per view.

Modifications to the view by the application of element access functions accumulate as partial results. At some point before the algorithm returns, the partial results are combined, two at a time, using the std::bit_xor{} operation until a single value remains, which is then assigned back to the live-out object.

T shall meet the requirements of CopyConstructible and MoveAssignable.

Note

In order to produce useful results, modifications to the view should be limited to commutative operations closely related to the combiner operation.

Template Parameters
  • T – The value type to be used by the induction object.

  • Op – The type of the binary function (object) used to perform the reduction operation.

Parameters
  • var – [in,out] The life-out value to use for the reduction object. This will hold the reduced value after the algorithm is finished executing.

  • identity – [in] The identity value to use for the reduction operation. This argument is optional and defaults to a copy of var.

Returns

This returns a reduction object of unspecified type having a value type of T. When the return value is used by an algorithm, the reference to var is used as the live-out object, new views are initialized to a copy of identity, and views are combined by invoking the copy of combiner, passing it the two views to be combined.

template<typename T>
constexpr hpx::parallel::detail::reduction_helper<T, std::bit_xor<T>> reduction_bit_xor(T &var, T const &identity)#