Algorithm (C++)
In the C++ Standard Library, the algorithms library provides various functions that perform algorithmic operations on containers and other sequences, represented by Iterators.[1] The C++ standard provides some standard algorithms collected in the Execution policiesC++17 provides the ability for many algorithms to optionally take an execution policy, which may allow implementations to execute the algorithm in parallel (i.e. by using threads or SIMD instructions). There are four different policy types, each indicating different semantics about the order in which element accesses are allowed to be observed relative to each other
It is up to the user to ensure that the operations performed by the function are thread safe when using policies which may execute across different threads. RangesC++20 adds versions of the algorithms defined in the The ranges versions of algorithm functions are scoped within the Non-modifying sequence operationsPredicate checking algorithmsChecks if a given predicate evaluates to true for some amount of objects in the range, or returns the amount of objects that do
Comparison algorithmsCompares two ranges for some property
Searching algorithmsFinds the first or last position in a range where the subsequent elements satisfy some predicate
Binary search algorithmsProvides Binary search operations on ranges. It is undefined behaviour to use these on ranges which are not sorted.
Maximum/Minimum search algorithmsFinds the maximum or minimum element in a range, as defined by some comparison predicate
Property checking algorithmsChecks if an entire range satisfies some property
Modifying sequence operationsCopying algorithmsTransfers the elements from one range into another
Partitioning algorithmsMoves the elements of a range in-place so the range is partitioned with respect to some property
Sorting algorithmsSorts or partially sorts a range in-place
Populating algorithmsPopulates a given range without reading the values contained within
Transforming algorithmsTransforms each element of a given range in-place
Reordering algorithmsChanges the order of elements within a range in-place
Heap algorithmsProvides algorithms to create, insert, and remove elements from a max heap
References
External links |