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 |
---|---|
Overloaded. Constructs a new combinable object. |
|
Destroys a combinable object. |
Public Methods
Name |
Description |
---|---|
Clears any intermediate computational results from a previous usage. |
|
Computes a final value from the set of thread-local sub-computations by calling the supplied combine functor. |
|
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. |
|
Overloaded. Returns a reference to the thread-private sub-computation. |
Public Operators
Name |
Description |
---|---|
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