Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/experimental/parallelism"

From cppreference.com
(Parallelized versions of existing algorithms: + list)
(Parallelized versions of existing algorithms: +)
Line 98: Line 98:
 
* {{lc|std::unique_copy}}
 
* {{lc|std::unique_copy}}
 
</div>
 
</div>
 +
Each parallelized algorithm:
 +
* is declared in the {{tt|std::experimental::parallel}} namespace; <!-- technically, it's in parallel::v1, but we ignore the inline namespace for other purposes too -->
 +
* compared to the original algorithm, has an additional template parameter named {{tt|ExecutionPolicy}}, which is the first template parameter;
 +
* compared to the original algorithm, has an additional function parameter of type {{tt|ExecutionPolicy&&}}, which is the first function parameter;
 +
* does not participate in overload resolution unless {{c|is_execution_policy<std::decay_t<ExecutionPolicy>>::value}} is {{tt|true}};
 +
* has semantics that is identical to the original algorithm.
  
 
===New algorithms===
 
===New algorithms===

Revision as of 12:40, 27 July 2015

 
 
Experimental
Technical Specification
Filesystem library (filesystem TS)
Library fundamentals (library fundamentals TS)
Library fundamentals 2 (library fundamentals TS v2)
Library fundamentals 3 (library fundamentals TS v3)
Extensions for parallelism (parallelism TS)
Extensions for parallelism 2 (parallelism TS v2)
Extensions for concurrency (concurrency TS)
Extensions for concurrency 2 (concurrency TS v2)
Concepts (concepts TS)
Ranges (ranges TS)
Reflection (reflection TS)
Mathematical special functions (special functions TR)
Experimental Non-TS
Pattern Matching
Linear Algebra
std::execution
Contracts
2D Graphics
 
 

The C++ Extensions for Parallelism, ISO/IEC TS 19570:xxxx, defines the following new components for the C++ standard library:

Contents

Execution policies

sequential execution policy
(class)
parallel execution policy
(class)
parallel/vector execution policy
(class)
dynamic execution policy
(class)

Exception lists

exceptions raised during parallel executions
(class)

Parallelized versions of existing algorithms

Provides parallelized versions of 69 algorithms from <algorithm>, <numeric> and <memory>:

Each parallelized algorithm:

  • is declared in the std::experimental::parallel namespace;
  • compared to the original algorithm, has an additional template parameter named ExecutionPolicy, which is the first template parameter;
  • compared to the original algorithm, has an additional function parameter of type ExecutionPolicy&&, which is the first function parameter;
  • does not participate in overload resolution unless is_execution_policy<std::decay_t<ExecutionPolicy>>::value is true;
  • has semantics that is identical to the original algorithm.

New algorithms

Defined in header <experimental/algorithm>
similar to std::for_each except returns void
(function template)
applies a function object to the first n elements of a sequence
(function template)
Defined in header <experimental/numeric>
similar to std::accumulate, except out of order
(function template)
similar to std::partial_sum, excludes the ith input element from the ith sum
(function template)
similar to std::partial_sum, includes the ith input element in the ith sum
(function template)
applies a functor, then reduces
(function template)
applies a functor, then calculates exclusive scan
(function template)
applies a functor, then calculates inclusive scan
(function template)