[libcxx-commits] [PATCH] D116296: [libc++] Add an early return for __partial_sort of an empty range.
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jan 4 13:15:52 PST 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf6fb7bf636e3: [libc++] Add an early return for __partial_sort of an empty range. (authored by arthur.j.odwyer).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116296/new/
https://reviews.llvm.org/D116296
Files:
libcxx/include/__algorithm/partial_sort.h
Index: libcxx/include/__algorithm/partial_sort.h
===================================================================
--- libcxx/include/__algorithm/partial_sort.h
+++ libcxx/include/__algorithm/partial_sort.h
@@ -33,6 +33,8 @@
__partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
_Compare __comp)
{
+ if (__first == __middle)
+ return;
_VSTD::__make_heap<_Compare>(__first, __middle, __comp);
typename iterator_traits<_RandomAccessIterator>::difference_type __len = __middle - __first;
for (_RandomAccessIterator __i = __middle; __i != __last; ++__i)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116296.397387.patch
Type: text/x-patch
Size: 647 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220104/dd8f8fc2/attachment-0001.bin>
More information about the libcxx-commits
mailing list