Daily bit(e) of C++ | std::sort
Daily bit(e) of C++ ♻️193, The standard sort algorithm: std::sort.
The std::sort is perhaps the most well-known standard algorithm.
The sort implementation is required to be O(n*logn) but is not required to be stable, meaning it can change the relative order of equivalent elements.
The algorithm has a C++17 parallel and a C++20 range variants and supports constexpr since C++20.
Note that std::sort requires a strict-weak ordering (by default through std::less{}), which implies irreflexivity and transitivity of the comparator.