Nonmodifying Sequence Operations | |
for_each() find() find_if() find_first_of() adjacent_find() count() count_if() mismatch() equal() search() find_end() search_n() |
Do operation for each element in a sequence Find first occurrence of a value in a sequence Find first match of a predicate in a sequence Find a value from one sequence in another Find an adjacent pair of values Count occurrences of a value in a sequence Count matches of a predicate in a sequence Find the first elements for which two sequences differ True if the elements of two sequences are pairwise equal Find the first occurrence of a sequence as a subsequence Find the last occurrence of a sequence as a subsequence Find the nth occurrence of a value in a sequence |
Modifying Sequence Operations | |
transform() copy() copy_backward() swap() iter_swap() swap_ranges() replace() replace_if() replace_copy() replace_copy_if() fill() fill_n() generate() generate_n() remove() remove_if() remove_copy() remove_copy_if() unique() unique_copy() reverse() reverse_copy() rotate() rotate_copy() random_shuffle() |
Apply an operation to every element in a sequence Copy a sequence starting with its first element Copy a sequence starting with its last element Swap two elements Swap two elements pointed to by iterators Swap elements of two sequences Replace elements with a given value Replace elements matching a predicate Copy a sequence replacing elements with a given value Copy a sequence replacing elements matching a predicate Replace every element with a given value Replace first n elements with a given value Replace every element with the result of an operation Replace first n elements with the result of an operation Remove elements with a value Remove elements matching a predicate Copy a sequence removing elements with a given value Copy a sequence removing elements matching a predicate Remove equal adjacent elements Copy a sequence removing equal adjacent elements Reverse the order of elements Copy a sequence into reverse order Rotate elements Copy a sequence into a rotated sequence Move elements into a uniform distribution |
Sorted Sequences | |
sort() stable_sort() partial_sort() partial_sort_copy() nth_element() lower_bound() upper_bound() equal_range() binary_search() merge() inplace_merge() partition() stable_partition() |
Sort with good average efficiency Sort maintaining order of equal elements Get the first part of sequence into order Copy getting the first part of output into order Put the nth element in its proper place Find the first occurrence of a value Find the last occurrence of a value Find a subsequence with a given value Is a given value in a sorted sequence? Merge two sorted sequences Merge two consecutive sorted subsequences Place elements matching a predicate first Place elements matching a predicate first, preserving relative order |
Set Algorithms | |
includes() set_union() set_intersection() set_difference() set_symmetric_difference() |
True if a sequence is a subsequence of another Construct a sorted union Construct a sorted intersection Construct a sorted sequence of elements in the first but not the second sequence Construct a sorted sequence of elements in one but not both sequences |
Heap Operations | |
make_heap() push_heap() pop_heap() sort_heap() |
Make sequence ready to be used as a heap Add element to heap Remove element from heap Sort the heap |
Minimum and Maximum | |
min() max() min_element() max_element() lexicographical_compare() |
Smaller of two values Larger of two values Smallest value in sequence Largest value in sequence Lexicographically first of two sequences |
Permutations | |
next_perinutation() prev_permutation() |
Next permutation in lexicographical order Previous permutation in lexicographical order |
Predicates <functional> | |
equal_to not_equal_to greater less greater_equal less_equal logical_and logical_or logical_not (unary) |
arg1 == arg2 arg1 != arg2 arg1 > arg2 arg1 < arg2 arg1 >= arg2 arg1 <= arg2 arg1 && arg2 arg1 || arg2 !arg |
Arithmetic Operations <functional> | |
plus minus multiplies divides modulus negate (unary) |
arg1 + arg2 arg1 - arg2 arg1 * arg2 arg1 / arg2 arg1 % arg2 -arg |
Binders, Adapters, and Negaters <functional> | |
bind2nd(y) bind1st(x) mem_fun() mem_fun_ref() ptr_fun() ptr_fun() not1() not2() |
Call binary function with y as 2nd argument Call binary function with x as 1st argument Call 0-arg member through pointer Call 0-arg member through reference Call unary pointer to function Call binary pointer to function Negate unary predicate Negate binary predicate |