Difference between revisions of "cpp/experimental/parallelism"
From cppreference.com
< cpp | experimental
(→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
The C++ Extensions for Parallelism, ISO/IEC TS 19570:xxxx, defines the following new components for the C++ standard library:
Contents |
Execution policies
Defined in header
<experimental/execution_policy> | |
sequential execution policy (class) | |
parallel execution policy (class) | |
parallel/vector execution policy (class) | |
dynamic execution policy (class) |
Exception lists
Defined in header
<experimental/exception_list> | |
exceptions raised during parallel executions (class) |
Parallelized versions of existing algorithms
Provides parallelized versions of 69 algorithms from <algorithm>, <numeric> and <memory>:
- std::adjacent_difference
- std::adjacent_find
- std::all_of
- std::any_of
- std::copy
- std::copy_if
- std::copy_n
- std::count
- std::count_if
- std::equal
- std::fill
- std::fill_n
- std::find
- std::find_end
- std::find_first_of
- std::find_if
- std::find_if_not
- std::generate
- std::generate_n
- std::includes
- std::inner_product
- std::inplace_merge
- std::is_heap
- std::is_heap_until
- std::is_partitioned
- std::is_sorted
- std::is_sorted_until
- std::lexicographical_compare
- std::max_element
- std::merge
- std::min_element
- std::minmax_element
- std::mismatch
- std::move
- std::none_of
- std::nth_element
- std::partial_sort
- std::partial_sort_copy
- std::partition
- std::partition_copy
- std::remove
- std::remove_copy
- std::remove_copy_if
- std::remove_if
- std::replace
- std::replace_copy
- std::replace_copy_if
- std::replace_if
- std::reverse
- std::reverse_copy
- std::rotate
- std::rotate_copy
- std::search
- std::search_n
- std::set_difference
- std::set_intersection
- std::set_symmetric_difference
- std::set_union
- std::sort
- std::stable_partition
- std::stable_sort
- std::swap_ranges
- std::transform
- std::uninitialized_copy
- std::uninitialized_copy_n
- std::uninitialized_fill
- std::uninitialized_fill_n
- std::unique
- std::unique_copy
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) |