https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100223
Bug ID: 100223 Summary: Missing early return in std::partial_sort Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: hewillk at gmail dot com Target Milestone: --- Hi, can we add an early return to std::partial_sort to avoid unnecessary O(n) operations when __first is equal to __middle, just like std::rotate does, and make the result more consistent with ranges::partial_sort? https://godbolt.org/z/Kb5x8zfeh