std::sortable(3)
π NAME π
okay so welcome to the std::sortable(3) page from the C++ Standard Libary π
bestie, this is the manual for std::sortable β yes, the NAME line is literally std::sortable - std::sortable, it's giving self-titled debut album and honestly? iconic β¨
πΈ Synopsis πΈ
std::sortable lives in the header <iterator>, and here's the exact signature vibe:
Defined in header <iterator>
template< class I, class Comp = ranges::less, class Proj =
std::identity >
concept sortable =
(since C++20)
std::permutable<I> &&
std::indirect_strict_weak_order<Comp, std::projected<I, Proj>>;
So yeah: it's a concept (since C++20) and it's built from std::permutable<I> and std::indirect_strict_weak_order<Comp, std::projected<I, Proj>> β no cap, that's the whole formula π§
The sortable concept is basically the requirements checklist for algorithms that permute a range into an ordered range according to Comp. It's the vibe check for sort-ish algorithms π
π§ Semantic requirements π§
std::sortable<I, Comp, Proj> is modeled only if all concepts it subsumes are modeled. That's it, that's the rule β if the concepts it subsumes aren't modeled, it's not modeled either, periodt π
π See also π
ranges::sortβ sorts a range into ascending order (C++20) (niebloid) π₯ranges::stable_sortβ sorts a range of elements while preserving order between equal elements (C++20) (niebloid) π«Άranges::partial_sortβ sorts the first N elements of a range (C++20) (niebloid) β¨ranges::nth_elementβ partially sorts the given range making sure that it is partitioned by the given element (C++20) (niebloid) π¦ranges::inplace_mergeβ merges two ordered ranges in-place (C++20) (niebloid) πranges::push_heapβ adds an element to a max heap (C++20) (niebloid) πranges::pop_heapβ removes the largest element from a max heap (C++20) (niebloid) πranges::make_heapβ creates a max heap out of a range of elements (C++20) (niebloid) πranges::sort_heapβ turns a max heap into a range of elements sorted in ascending order (C++20) (niebloid) βranges::next_permutationβ generates the next greater lexicographic permutation of a range of elements (C++20) (niebloid) πranges::prev_permutationβ generates the next smaller lexicographic permutation of a range of elements (C++20) (niebloid) π§
Signed, sealed, delivered: source/version http://cppreference.com, date 2024.06.10, page std::sortable(3) β bye bestie, go sort something cute ππ«Ά
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms