stl:algorithm:start

C++ Reference

C++ Algorithms

accumulatesum up a range of elements
adjacent_differencecompute the differences between adjacent elements in a range
adjacent_findfinds two items adjacent to each other
binary_searchdetermine if an element exists in a certain range
copycopy some range of elements to a new location
copy_backwardcopy a range of elements in backwards order
countreturn the number of elements matching a given value
count_ifreturn the number of elements for which a predicate is true
equaldetermine if two sets of elements are the same
equal_rangesearch for a range of elements that are all equal to a certain element
fillassign a range of elements a certain value
fill_nassign a value to some number of elements
findfind a value in a given range
find_endfind the last sequence of elements in a certain range
find_first_ofsearch for any one of a set of elements
find_iffind the first element for which a certain predicate is true
for_eachapply a function to a range of elements
generatesaves the result of a function in a range
generate_nsaves the result of N applications of a function
includesreturns true if one set is a subset of another
inner_productcompute the inner product of two ranges of elements
inplace_mergemerge two ordered ranges in-place
is_heapreturns true if a given range is a heap
is_sortedreturns true if a range is sorted in ascending order
iter_swapswaps the elements pointed to by two iterators
lexicographical_comparereturns true if one range is lexicographically less than another
lower_boundsearch for the first place that a value can be inserted while preserving order
make_heapcreates a heap out of a range of elements
maxreturns the larger of two elements
max_elementreturns the largest element in a range
mergemerge two sorted ranges
minreturns the smaller of two elements
min_elementreturns the smallest element in a range
mismatchfinds the first position where two ranges differ
next_permutationgenerates the next greater lexicographic permutation of a range of elements
nth_elementput one element in its sorted location and make sure that no elements to its left are greater than any elements to its right
partial_sortsort the first N elements of a range
partial_sort_copycopy and partially sort a range of elements
partial_sumcompute the partial sum of a range of elements
partitiondivide a range of elements into two groups
pop_heapremove the largest element from a heap
prev_permutationgenerates the next smaller lexicographic permutation of a range of elements
push_heapadd an element to a heap
random_shufflerandomly re-order elements in some range
removeremove elements equal to certain value
remove_copycopy a range of elements omitting those that match a certian value
remove_copy_ifcreate a copy of a range of elements, omitting any for which a predicate is true
remove_ifremove all elements for which a predicate is true
replacereplace every occurrence of some value in a range with another value
replace_copycopy a range, replacing certain elements with new ones
replace_copy_ifcopy a range of elements, replacing those for which a predicate is true
replace_ifchange the values of elements for which a predicate is true
reversereverse elements in some range
reverse_copycreate a copy of a range that is reversed
rotatemove the elements in some range to the left by some amount
rotate_copycopy and rotate a range of elements
searchsearch for a range of elements
search_nsearch for N consecutive copies of an element in some range
set_differencecomputes the difference between two sets
set_intersectioncomputes the intersection of two sets
set_symmetric_differencecomputes the symmetric difference between two sets
set_unioncomputes the union of two sets
sortsort a range into ascending order
sort_heapturns a heap into a sorted range of elements
stable_partitiondivide elements into two groups while preserving their relative order
stable_sortsort a range of elements while preserving order between equal elements
swapswap the values of two objects
swap_rangesswaps two ranges of elements
transformapplies a function to a range of elements
uniqueremove consecutive duplicate elements in a range
unique_copycreate a copy of some range of elements that contains no consecutive duplicates
upper_boundsearches for the last possible location to insert an element into an ordered range