std::experi...ranges::sort(3)
π std::experimental::ranges::sort π
okay so bestie, this is the C++ Standard Libary manual page for std::experimental::ranges::sort. The header calls it std::experi...ranges::sort(3), and yes, the truncation is iconic in its own chaotic way. We're in ranges TS territory, so there's projections, comparators, and a whole vibe. Let's get into it. π«Ά
β¨ NAME β¨
std::experimental::ranges::sort β std::experimental::ranges::sort
πΈ Synopsis πΈ
Defined in header <experimental/ranges/algorithm>
template< RandomAccessIterator I, Sentinel<I> S,
class Comp = ranges::less<>, class Proj = ranges::identity
>
(1) (ranges TS)
requires Sortable<I, Comp, Proj>
I sort( I first, S last, Comp comp = Comp{}, Proj proj = Proj{} );
template< RandomAccessRange R,
class Comp = ranges::less<>, class Proj = ranges::identity
>
(2) (ranges TS)
requires Sortable<ranges::iterator_t<R>, Comp, Proj>
ranges::safe_iterator_t<R> sort( R&& r, Comp comp = Comp{}, Proj
proj = Proj{} );
- Sorts the elements in the range
[first, last)in ascending order. The order of equal elements is not guaranteed to be preserved. Elements are compared usingcompafter applying the projectionproj. π - Sorts the elements in the range
r, as if byreturn ranges::sort(ranges::begin(r), ranges::end(r), comp, proj);.
β οΈ Important caveat, fr fr: Notwithstanding the declarations depicted above, the actual number and order of template parameters for algorithm declarations is unspecified. Thus, if explicit template arguments are used when calling an algorithm, the program is probably non-portable.
π Parameters π
first,lastβ the range of elements to sort.rβ the range of elements to sort.compβ the comparator to use.projβ the projection to apply to elements in the range.
π Return value π
An iterator pointing past the end of the range (i.e., it compares equal to last for overload (1), and ranges::end(r) for overload (2)).
π₯ Complexity π₯
O(NΒ·log(N)) comparisons, where N is equal to the number of elements in the range.
π¦ Example π¦
This section is incomplete Reason: no example
bestie, it's giving unfinished, but that's literally what the page says. π
π See also π
sortβ sorts a range into ascending order (function template)
π Category π
- Todo no example
stay hydrated and sorted, bestie π β source/version http://cppreference.com, date 2024.06.10, page std::experi...ranges::sort(3).
π¦ 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