Name | Input ranges* | Accumulator | Returns⌖ | Operations† | Default operations | Complexity | Order‡ | Compare to |
inner_product | 2 | Arg | Value | A, bT | plus, multiplies | Unspc. | Fwd. | transform_reduce |
adjacent_reduce▸ | 1s | Arg | Value | A, bT | Unspc. | Fwd. | inner_product | |
transform_reduce | 1 / 2 | Arg | Value | acR, uT / bT | plus, multiplies | O(N) | ∥ | |
find | 1+Value | Position | equal_to | O(N) | S/C∥ | |||
find_if, find_if_not | 1 | Position | uP | O(N) | S/C∥ | |||
find_first_of | 2 | Position | bP | equal_to | O(S×N) | S/C∥ | find_if | |
min_element, max_element | 1 | First | Position | bP | less | O(N), =(max(N-1, 0)) | Fwd.∥ | |
minmax_element | 1 | First | 2 Positions⌖ | bP | less | O(N), ≤(max(floor((3/2)*(N−1)), 0)) | Fwd.∥ | |
lower_bound, upper_bound | 1+Value | Position | bP | less | O(log N) + O(1)↓R; O(N) | B/S | ||
equal_range | 1+Value | Range⌖ | bP | less | O(log N) + O(1)↓R; O(N) | B/S | ||
search | 2 | Position | bP | equal_to | ≤(S×N) | ∥ | ||
find_end | 2 | Position | bP | equal_to | ≤(S×(N-S+1)) | ∥ | search | |
starts_with | 2 | bool | bP | equal_to | N > S ? O(S) : O(1)↓R; O(min(S, N)) | Fwd. | ||
ends_with | 2 | bool | bP | equal_to | N > S ? O(S) : O(1)↓R; O(min(S, N)) | |||
ranges::starts_with, ranges::ends_with | 2 | bool | bP, uT, uTΔ | equal_to, identity, identity | ≤(min(S, N)) | |||
search (C++17) | 1 | Position | Searcher | Depends on Searcher | ||||
find_match | 2 | Position⌖ | bP | equal_to | O(N), O(min(N, M)) | S/C | ||
mismatch | 2 | Position⌖ | bP | equal_to | O(N), O(min(N, M)) | S/C∥ | find_match | |
adjacent_find | 1s | Position | bP | equal_to | =(min((result-first)+1, (last-first)-1)); O(N)↓∥ | S/C∥ | find_match | |
is_sorted_until | 1s | Position | bP | less | O(N) | S/C∥ | find_match | |
search_n | 1 + Count + Value | Position | bP | equal_to | ≤(N) | ∥ | adjacent_find | |
accumulate | 1 | Arg | Value | A | plus | Unspc.; O(N) | Fwd. | |
sum | 1 | First | Value | R | plus | O(N) | Fwd. | accumulate |
reduce | 1 | Arg | Value | acR | plus | O(N) | ∥ | |
count | 1+Value | 0 | size_t | equal_to | #NAME? | Fwd.∥ | accumulate | |
count_if | 1 | 0 | size_t | uP | #NAME? | Fwd.∥ | accumulate | |
binary_search | 1+Value | bool | bP | less | O(log N) + O(1)↓R; O(N) | B/S | ||
is_partitioned | 1 | bool | uP | O(N) | Fwd.∥ | |||
is_sorted | 1 | bool | bP | less | O(N) | Fwd.∥ | ||
is_heap | 1 | bool | bP | less | O(N) | ∥ | ||
is_permutation | 2 | bool | bP | equal_to | N==M ? O(N2) : O(1)↓R; O(N2) | |||
includes | 2 | bool | bP | less | O(N+M), ≤(2×(N+M-1)) | Fwd.∥ | ||
first_result | 1+Value / 2+Value | Arg | Value | uT / bT | O(N) | S/C | ||
first_result_if | 1 / 2 | Value | uT / bT, uP / bP | O(N) | S/C | |||
all_of, none_of | 1 | true | bool | uP | O(N) | S/C∥ | first_result | |
any_of | 1 | false | bool | uP | O(N) | S/C∥ | first_result | |
contains | 1+Value | false | bool | equal_to | O(N) | S/C | first_result | |
contains_any | 2 | false | bool | contains | O(S×N) | S/C | first_result | |
equal | 2 | bool | bP | equal_to | N==M ? ≤(N) : O(1)↓R; ≤(N); O(N)↓∥ | Fwd.∥ | first_result | |
lexicographical_compare | 2 | bool | bP | less | ≤(2×min(N, M)) | Fwd.∥ | first_result | |
lexicographical_compare_three_way | 2 | ordering | CompareΔ | compare_three_way | <(min(N, M)) | Fwd. | first_result | |
partition_point | 1 | Position | uP | O(log N)↓R; O(N) | B/S | |||
is_heap_until | 1 | Position | bP | less | O(N) | ∥ |
Name | Input ranges* | Accumulator | Output ranges | Operations† | Default operations | Complexity | Order‡ | Compare to |
transform_inclusive_scan | 1 | First, Arg | 1 | aR, uT | O(N) | ∥ | ||
transform_exclusive_scan | 1 | Arg | 1 | aR, uT | O(N) | ∥ | ||
partial_sum | 1 | First | 1 | A | plus | O(N), =(N - 1) | Fwd. | |
inclusive_scan | 1 | First, Arg | 1 | aR | plus | O(N) | ∥ | |
exclusive_scan | 1 | Arg | 1 | aR | plus | O(N) | ∥ | |
adjacent_difference | 1s | Quasi | 1 | fD | minus | O(N), =(N - 1) | Fwd.∥ | adjacent_transform |
adjacent_transform▸ | 1s | Quasi | 1 | D | O(N), =(N - 1) | Fwd.∥ | adjacent_difference | |
adjacent_inclusive_scan▸ | 1s | First | 1 | A, D | O(N) | Fwd. | ||
transform | 1 / 2 | 1 | uT / bT | #NAME? | ∥ | |||
copy, copy_n | 1 | 1 | #NAME? | Fwd.∥ | transform | |||
copy_backward | 1 | 1 | #NAME? | Rev. | ||||
move | 1 | 1 | #NAME? | Fwd.∥ | shift_left | |||
move_backward | 1 | 1 | #NAME? | Rev. | shift_right | |||
replace_copy | 1+Value | Arg | 1 | equal_to | #NAME? | Fwd.∥ | transform | |
replace_copy_if | 1 | Arg | 1 | uP | #NAME? | Fwd.∥ | transform | |
reverse_copy | 1 | 1 | #NAME? | ∥ | transform | |||
rotate_copy | 1d | 1 | O(N) | ∥ | ||||
sample | 1 | Arg | 1 | O(N) | Fwd. | |||
partial_sort_copy | 1 | 1 | bP | less | O(N log(min(D,N)) | ∥ | ||
partition_copy | 1 | 2 | uP | #NAME? | Fwd.∥ | |||
transform_if | 1 | 1 | uP, uT | O(N) | Fwd. | |||
copy_if, remove_copy_if | 1 | 1 | uP | O(N) | Fwd.∥ | transform_if | ||
remove_copy | 1+Value | 1 | equal_to | #NAME? | Fwd.∥ | transform_if | ||
unique_copy | 1 | First | 1 | bP | equal_to | O(N) | Fwd.∥ | |
set_difference, set_intersection, set_symmetric_difference, set_union | 2 | 1 | bP | less | O(N+M), ≤(2⋅(N+M)−1) | Fwd.∥ | ||
merge | 2 | 1 | bP | less | O(N+M) | Fwd.∥ | ||
regex_replace⧫ | 2 | 1 | Regex⧫ | Unspc. | See note⧫ | |||
search_replace_copy | 3 | 1 | bP | equal_to | O(N×(S+R)) | regex_replace⧫ | ||
generate, generate_n | 0 | 1 | G | #NAME? | Fwd.∥ | |||
iota | 0 | Arg | 1 | ++ | #NAME? | Fwd. | generate | |
iota | 0 | Arg | 1 | uT | ++ | #NAME? | Fwd. | generate |
fill, fill_n | 0 | Arg | 1 | #NAME? | Fwd.∥ | generate, generate_n | ||
for_each, for_each_n | 1 | 0∅ | muT | #NAME? | Fwd.∥ | |||
for_each, for_each_n | 1 / 2 | 0∅ | muT / mbT | #NAME? | Fwd. | |||
swap_ranges | 2 | Self | swap | O(N) | Fwd.∥ | for_each | ||
remove | 1+Value | Self | equal_to | O(N) | Fwd.∥ | |||
remove_if | 1 | Self | uP | O(N) | Fwd.∥ | |||
unique | 1 | Self | bP | equal_to | O(N) | Fwd.∥ | ||
replace | 1+Value | Self | equal_to | #NAME? | Fwd.∥ | transform | ||
replace_if | 1 | Self | uP | #NAME? | Fwd.∥ | transform | ||
reverse | 1 | Self | O(N), =(N/2) | Yes∥ | swap_ranges | |||
rotate | 1d | Self | O(N) | Yes∥ | ||||
shift_left | 1d | Self | ≤(N-n) | Fwd.∥ | move | |||
shift_right | 1d | Self | ≤(N-n) | Yes∥ | move_backward | |||
shuffle | 1+URBG | Self | O(N) | |||||
next_permutation, prev_permutation | 1 | Self | O(N), ≤(N/2) | |||||
partition | 1 | Self | uP | O(N); O(N log N)↓∥ | ∥ | |||
stable_partition | 1 | Self | uP | O(N) w/ memory, else O(N log N); O(N log N)↓∥ | ∥ | |||
sort | 1 | Self | bP | less | O(N log N) | ∥ | ||
partial_sort | 1 | Self | bP | less | O(N log M) | ∥ | ||
stable_sort | 1 | Self | bP | less | O(N log N) w/ memory, else O(N log(N)2) | ∥ | ||
nth_element | 1 | Self | bP | less | O(N); O(N log N)↓∥ | ∥ | ||
make_heap | 1 | Self | bP | less | O(N), ≤(3N) | |||
push_heap, pop_heap | 1 | Self | bP | less | O(log N) | |||
sort_heap | 1 | Self | bP | less | O(N log N) | |||
inplace_merge | 1d | Self | bP | less | =(N-1) w/ memory, O(N log N); O(N log N)↓∥ | ∥ |