Namespaces
Variants
Actions

Standard library header <algorithm>

From cppreference.com
< cpp‎ | header
 
 
Standard library headers
Algorithms
<algorithm>
<numeric>
Strings
<cctype>
<cstring>
<cuchar> (C++11)
<cwchar>
<cwctype>
<string_view> (C++17)
<string>
Text processing
<clocale>
<codecvt> (C++11/17/26*)
<locale>
<regex> (C++11)
<text_encoding> (C++26)   
Numerics
<cfenv> (C++11)
<cmath>
<complex>
<linalg> (C++26)
<numbers> (C++20)
<random> (C++11)
<simd> (C++26)
<stdckdint.h> (C++26)
<valarray>
Time
<chrono> (C++11)
<ctime>
C compatibility
<ccomplex> (C++11/17/20*)
<ciso646> (until C++20)
<cstdalign> (C++11/17/20*)
<cstdbool> (C++11/17/20*)
<ctgmath> (C++11/17/20*)
 

This header is part of the algorithm library.

Contents

Includes

std::initializer_list class template[edit]

Classes

Defined in namespace std::ranges
Return types (C++20)
provides a way to store an iterator and a function object as a single unit
(class template) [edit]
provides a way to store two iterators as a single unit
(class template) [edit]
provides a way to store two iterators as a single unit
(class template) [edit]
provides a way to store three iterators as a single unit
(class template) [edit]
provides a way to store three iterators as a single unit
(class template) [edit]
provides a way to store two objects or references of the same type as a single unit
(class template) [edit]
provides a way to store an iterator and a boolean flag as a single unit
(class template) [edit]
provides a way to store an iterator and a value as a single unit
(class template) [edit]
provides a way to store an iterator and a value as a single unit
(class template) [edit]

Functions

Non-modifying sequence operations
(C++11)(C++11)(C++11)
checks if a predicate is true for all, any or none of the elements in a range
(function template) [edit]
applies a unary function object to elements from a range
(function template) [edit]
applies a function object to the first N elements of a sequence
(function template) [edit]
returns the number of elements satisfying specific criteria
(function template) [edit]
finds the first position where two ranges differ
(function template) [edit]
finds the first element satisfying specific criteria
(function template) [edit]
finds the last sequence of elements in a certain range
(function template) [edit]
searches for any one of a set of elements
(function template) [edit]
finds the first two adjacent items that are equal (or satisfy a given predicate)
(function template) [edit]
searches for the first occurrence of a range of elements
(function template) [edit]
searches for the first occurrence of a number consecutive copies of an element in a range
(function template) [edit]
Modifying sequence operations
copies a range of elements to a new location
(function template) [edit]
(C++11)
copies a number of elements to a new location
(function template) [edit]
copies a range of elements in backwards order
(function template) [edit]
(C++11)
moves a range of elements to a new location
(function template) [edit]
moves a range of elements to a new location in backwards order
(function template) [edit]
copy-assigns the given value to every element in a range
(function template) [edit]
copy-assigns the given value to N elements in a range
(function template) [edit]
applies a function to a range of elements, storing results in a destination range
(function template) [edit]
assigns the results of successive function calls to every element in a range
(function template) [edit]
assigns the results of successive function calls to N elements in a range
(function template) [edit]
removes elements satisfying specific criteria
(function template) [edit]
copies a range of elements omitting those that satisfy specific criteria
(function template) [edit]
replaces all values satisfying specific criteria with another value
(function template) [edit]
copies a range, replacing elements satisfying specific criteria with another value
(function template) [edit]
swaps the values of two objects
(function template) [edit]
swaps two ranges of elements
(function template) [edit]
swaps the elements pointed to by two iterators
(function template) [edit]
reverses the order of elements in a range
(function template) [edit]
creates a copy of a range that is reversed
(function template) [edit]
rotates the order of elements in a range
(function template) [edit]
copies and rotate a range of elements
(function template) [edit]
shifts elements in a range
(function template) [edit]
(until C++17)(C++11)
randomly re-orders elements in a range
(function template) [edit]
(C++17)
selects N random elements from a sequence
(function template) [edit]
removes consecutive duplicate elements in a range
(function template) [edit]
creates a copy of some range of elements that contains no consecutive duplicates
(function template) [edit]
Partitioning operations
determines if the range is partitioned by the given predicate
(function template) [edit]
divides a range of elements into two groups
(function template) [edit]
copies a range dividing the elements into two groups
(function template) [edit]
divides elements into two groups while preserving their relative order
(function template) [edit]
locates the partition point of a partitioned range
(function template) [edit]
Sorting operations
(C++11)
checks whether a range is sorted into ascending order
(function template) [edit]
finds the largest sorted subrange
(function template) [edit]
sorts a range into ascending order
(function template) [edit]
sorts the first N elements of a range
(function template) [edit]
copies and partially sorts a range of elements
(function template) [edit]
sorts a range of elements while preserving order between equal elements
(function template) [edit]
partially sorts the given range making sure that it is partitioned by the given element
(function template) [edit]
Binary search operations (on sorted ranges)
returns an iterator to the first element not less than the given value
(function template) [edit]
returns an iterator to the first element greater than a certain value
(function template) [edit]
determines if an element exists in a partially-ordered range
(function template) [edit]
returns range of elements matching a specific key
(function template) [edit]
Other operations on sorted ranges
merges two sorted ranges
(function template) [edit]
merges two ordered ranges in-place
(function template) [edit]
Set operations (on sorted ranges)
returns true if one sequence is a subsequence of another
(function template) [edit]
computes the difference between two sets
(function template) [edit]
computes the intersection of two sets
(function template) [edit]
computes the symmetric difference between two sets
(function template) [edit]
computes the union of two sets
(function template) [edit]
Heap operations
(C++11)
checks if the given range is a max heap
(function template) [edit]
finds the largest subrange that is a max heap
(function template) [edit]
creates a max heap out of a range of elements
(function template) [edit]
adds an element to a max heap
(function template) [edit]
removes the largest element from a max heap
(function template) [edit]
turns a max heap into a range of elements sorted in ascending order
(function template) [edit]
Minimum/maximum operations
returns the greater of the given values
(function template) [edit]
returns the largest element in a range
(function template) [edit]
returns the smaller of the given values
(function template) [edit]
returns the smallest element in a range
(function template) [edit]
(C++11)
returns the smaller and larger of two elements
(function template) [edit]
returns the smallest and the largest elements in a range
(function template) [edit]
(C++17)
clamps a value between a pair of boundary values
(function template) [edit]
Comparison operations
determines if two sets of elements are the same
(function template) [edit]
returns true if one range is lexicographically less than another
(function template) [edit]
compares two ranges using three-way comparison
(function template) [edit]
Permutation operations
determines if a sequence is a permutation of another sequence
(function template) [edit]
generates the next greater lexicographic permutation of a range of elements
(function template) [edit]
generates the next smaller lexicographic permutation of a range of elements
(function template) [edit]

Function-like entities (C++20)

Defined in namespace std::ranges
Non-modifying sequence operations
checks if a predicate is true for all, any or none of the elements in a range
(algorithm function object)[edit]
applies a unary function object to elements from a range
(algorithm function object)[edit]
applies a function object to the first N elements of a sequence
(algorithm function object)[edit]
returns the number of elements satisfying specific criteria
(algorithm function object)[edit]
finds the first position where two ranges differ
(algorithm function object)[edit]
finds the first element satisfying specific criteria
(algorithm function object)[edit]
finds the last element satisfying specific criteria
(algorithm function object)[edit]
finds the last sequence of elements in a certain range
(algorithm function object)[edit]
searches for any one of a set of elements
(algorithm function object)[edit]
finds the first two adjacent items that are equal (or satisfy a given predicate)
(algorithm function object)[edit]
searches for the first occurrence of a range of elements
(algorithm function object)[edit]
searches for the first occurrence of a number consecutive copies of an element in a range
(algorithm function object)[edit]
checks if the range contains the given element or subrange
(algorithm function object)[edit]
checks whether a range starts with another range
(algorithm function object)[edit]
checks whether a range ends with another range
(algorithm function object)[edit]
Fold operations