List of Algorithms by
Category
|
 |
This section provides a list of
all the standard STL algorithms listed by category,
together with an encoded description of their input parameters and a brief
synopsis. The following table shows the meanings of letters used to
decode input parameters shown in the algorithm list.
| Key |
Meaning |
Key |
Meaning |
|
b
|
Bi-directional iterator
|
p
|
Predicate
|
|
f
|
Forward iterator
|
r
|
Random access iterator
|
|
g
|
Function object
|
v
|
Value
|
|
i
|
Input iterator
|
&
|
Reference to a value
|
|
o
|
Output iterator
|
|
|
For example, the input parameters
for the for_each() algorithm are iig
. Using the above table, you can determine that for_each()
takes two input iterators and a function object as arguments.
Applying
for_each |
iig |
Apply a function to every item in a range. |
Bounding
equal_range |
ffv |
Return the lower and upper bounds within a range. |
lower_bound |
ffv |
Return the lower bound within a range. |
upper_bound |
ffv |
Return the upper bound within a range. |
Comparing
equal |
iii |
Check that two sequences match. |
lexicographical_compare |
iii |
Lexicographically compare two sequences. |
mismatch |
iii |
Search two sequences for a mismatched item. |
Copying
copy |
iio |
Copy a range of items to another area. |
copy_backward |
bbb |
Copy a range of items backwards to another area. |
Counting
count |
iiv |
Count items in a range matching a value. |
count_if |
iip |
Count items in a range satisfying a predicate. |
Filling
fill |
ff |
Set every item in a range to a particular value. |
fill_n |
o |
Set n items to a particular value. |
Filtering
unique |
ff |
Collapse all consecutive values in a sequence. |
unique_copy |
iio |
Copy a sequence, collapsing consecutive values. |
Generating
generate |
ffg |
Fill a sequence using a generator function. |
generate_n |
og |
Generate a specified number of items. |
Heap
make_heap |
rr |
Make a sequence into a heap. |
pop_heap |
rr |
Pop the top value from a heap. |
push_heap |
rr |
Place the last element into a heap. |
sort_heap |
rr |
Sort a heap. |
Math Operations
accumulate |
iiv |
Sum the values in a range. |
adjacent_difference |
iio |
Calculate the difference between adjacent pairs of values. |
inner_product |
iiiv |
Calculate the inner product of two sequences. |
partial_sum |
iio |
Fill a range with a running total. |
median |
vvv |
Calculate the median of three values. |
Merging
inplace_merge |
bbb |
Merge two sorted lists in place into a single sorted list. |
merge |
iiiio |
Merge two sorted lists into a single sorted list. |
Min/Max
min |
&& |
Return the minimum of two items. |
max |
&& |
Return the maximum of two items. |
min_element |
ii |
Return the minimum item within a range. |
max_element |
ii |
Return the maximum item within a range. |
Partitioning
nth_element |
rrr |
Partition a range by its nth element. |
partition |
bbp |
Partition a range using a predicate. |
stable_partition |
bbp |
Partition a range using a predicate. |
Permuting
next_permutation |
bb |
Change sequence to next lexicographic permutation. |
prev_permutation |
bb |
Change sequence to last lexicographic permutation. |
Removing
remove |
ffv |
Remove all matching items from a sequence. |
remove_copy |
iiov |
Copy sequence, removing all matching items. |
remove_copy_if |
iiop |
Copy sequence, removing all that satisfy predicate. |
remove_if |
ffp |
Remove items satisfying predicate from a sequence. |
Replacing
replace |
ffvv |
Replace specified value in a sequence with another. |
replace_copy |
iiovv |
Copy sequence replacing values satisfying predicate. |
replace_if |
ffpv |
Replace specified values satisfying a predicate. |
Reversing
reverse |
bb |
Reverse the items in a sequence. |
reverse_copy |
bbo |
Create a reversed copy of a sequence. |
Rotating
rotate |
fff |
Rotate a sequence by n positions. |
rotate_copy |
fffo |
Copy a sequence, rotating it by |
| n positions.
|
Searching
adjacent_find |
ii |
Locate consecutive sequence in a range. |
binary_search |
ffv |
Locate an item in a sorted sequence. |
find |
iiv |
Locate an item in a sequence. |
find_if |
iip |
Locate an item satisfying a predicate in a range. |
search |
ffff |
Locate one sequence within another. |
Set Operations
includes |
iiii |
Search for one sequence in another sequence. |
set_difference |
iiiio |
Create set of elements in first sequence that are not in second. |
set_intersection |
iiiio |
Create set of elements that are in both sequences. |
set_symmetric_difference |
iiiio |
Create set of elements that are not in both sequences. |
set_union |
iiiio |
Create set of elements that are in either sequence. |
Shuffling
random_shuffle |
rr |
Randomize sequence using random shuffles. |
Sorting
partial_sort |
rrr |
Sort the smallest n elements of a sequence. |
partial_sort_copy |
iirr |
Sort the smallest n elements of a sequence. |
sort |
rr |
Sort a sequence. |
stable_sort |
rr |
Sort a sequence. |
Swapping
iter_swap |
ff |
Swap the values indicated by two iterators. |
swap |
&& |
Swap two values. |
swap_ranges |
fff |
Swap two ranges of items. |
Transforming
transform |
iiog |
Transform one sequence into another. |
For detailed information about
a particular algorithm, consult the algorithm catalog in the back of this
manual. Additional, non-standard algorithms for
use with the Standard Template Library are provided in the
Helper<ToolKit>. Consult the Foundations User Guide
and Reference Manual for more details about the Helper<ToolKit>.
Copyright©1994-2026 Recursion
Software LLC
All Rights Reserved - For use by licensed users only.