Freigeben über


combinable Class

The combinable<T> object is intended to provide thread-private copies of data, to perform lock-free thread-local sub-computations during parallel algorithms. At the end of the parallel operation, the thread-private sub-computations can then be merged into a final result. This class can be used instead of a shared variable, and can result in a performance improvement if there would otherwise be a lot of contention on that shared variable.

template<
   typename _Ty
>
class combinable;

Parameters

  • _Ty
    The data type of the final merged result. The type must have a copy constructor and a default constructor.

Members

Public Constructors

Name

Description

combinable::combinable Constructor

Overloaded. Constructs a new combinable object.

combinable::~combinable Destructor

Destroys a combinable object.

Public Methods

Name

Description

combinable::clear Method

Clears any intermediate computational results from a previous usage.

combinable::combine Method

Computes a final value from the set of thread-local sub-computations by calling the supplied combine functor.

combinable::combine_each Method

Computes a final value from the set of thread-local sub-computations by calling the supplied combine functor once per thread-local sub-computation. The final result is accumulated by the function object.

combinable::local Method

Overloaded. Returns a reference to the thread-private sub-computation.

Public Operators

Name

Description

combinable::operator= Operator

Assigns to a combinable object from another combinable object.

Remarks

For more information, see Parallel Containers and Objects.

Inheritance Hierarchy

combinable

Requirements

Header: ppl.h

Namespace: concurrency

See Also

Reference

concurrency Namespace