-
Notifications
You must be signed in to change notification settings - Fork 0
Algorithm
DryPerspective edited this page Sep 19, 2023
·
3 revisions
Standard library algorithms added to the <algorithm> header since C++11. These do not include algorithms which require move semantics to function, and replace move semantics with copies where appropriate. Details of any function can be found on the cppreference <algorithm> page
The functions included are:
| all_of any_of none_of |
Checks if a predicate is true for all/any/none of the values in a range |
| for_each_n | Applies a function object to the first n elements of a range |
| find_if_not | Finds the first element of a range for which a predicate returns false |
| copy_if | Copies elements of a range which meet a certain predicate to another location |
| copy_n | Copies a number of elements to a new location |
| shift_left shift_right |
Shifts elements of a range left or right by n steps Note: this uses copy semantics, unlike the standard algorithm which moves |
| is_partitioned | Determines if a range is partitioned by a particular predicate |
| partition_copy | Copies a range, dividing the contents into two groups |
| partition_point | Finds the partition point of a given range |
| is_sorted | Checks whether a range is sorted into ascending order |
| is_sorted_until | Finds the largest sorted subrange |
| minmax | Finds the smaller and larger of two integers |
| minmax_element | Returns the smallest and largest values in a range |
| clamp | Clamps a value between two elements |