[Bug libstdc++/100223] New: Missing early return in std::partial_sort

hewillk at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Apr 23 03:16:56 GMT 2021


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


More information about the Gcc-bugs mailing list