Skip to content

Search topics & cppreference

Search all study topics, concept maps, and 6,587 C++ and C reference pages.

std::sortable

The sortable concept specifies the requirements for algorithms that permute a range into an ordered range according to Comp.

NotebookLM
Defined in header <iterator>
template< class I, class Comp = ranges::less, class Proj = std::identity >
concept sortable =
    std::permutable<I> &&
    std::indirect_strict_weak_order<Comp, std::projected<I, Proj>>;
(since C++20)

The sortable concept specifies the requirements for algorithms that permute a range into an ordered range according to Comp.

Semantic requirements

std::sortable<I, Comp, Proj> is modeled only if all concepts it subsumes are modeled.

See also

sorts a range into ascending order
(algorithm function object)
sorts a range of elements while preserving order between equal elements
(algorithm function object)
sorts the first N elements of a range
(algorithm function object)
partially sorts the given range making sure that it is partitioned by the given element
(algorithm function object)
merges two ordered ranges in-place
(algorithm function object)
adds an element to a max heap
(algorithm function object)
removes the largest element from a max heap
(algorithm function object)
creates a max heap out of a range of elements
(algorithm function object)
turns a max heap into a range of elements sorted in ascending order
(algorithm function object)
generates the next greater lexicographic permutation of a range of elements
(algorithm function object)
generates the next smaller lexicographic permutation of a range of elements
(algorithm function object)

Content from this page on cppreference.com, licensed under CC-BY-SA 3.0 and GFDL. Modified: restyled, site navigation removed, code windows added. Offline snapshot of 9 February 2025.