[libcxx-commits] [PATCH] D114133: [libc++] Minor fixups in the new introsort code.
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Nov 18 08:02:07 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1ce516d43f10: [libc++] Minor fixups in the new introsort code. (authored by arthur.j.odwyer).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114133/new/
https://reviews.llvm.org/D114133
Files:
libcxx/include/__algorithm/sort.h
Index: libcxx/include/__algorithm/sort.h
===================================================================
--- libcxx/include/__algorithm/sort.h
+++ libcxx/include/__algorithm/sort.h
@@ -131,7 +131,7 @@
_BidirectionalIterator __lm1 = __last;
for (--__lm1; __first != __lm1; ++__first)
{
- _BidirectionalIterator __i = _VSTD::min_element<_BidirectionalIterator, _Compare&>(__first, __last, __comp);
+ _BidirectionalIterator __i = _VSTD::min_element(__first, __last, __comp);
if (__i != __first)
swap(*__first, *__i);
}
@@ -268,13 +268,12 @@
template <class _Compare, class _RandomAccessIterator>
void
__introsort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp,
- typename _VSTD::iterator_traits<_RandomAccessIterator>::difference_type __depth)
+ typename iterator_traits<_RandomAccessIterator>::difference_type __depth)
{
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
const difference_type __limit = is_trivially_copy_constructible<value_type>::value &&
is_trivially_copy_assignable<value_type>::value ? 30 : 6;
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
while (true)
{
__restart:
@@ -307,7 +306,7 @@
if (__depth == 0)
{
// Fallback to heap sort as Introsort suggests.
- _VSTD::__partial_sort<_Comp_ref>(__first, __last, __last, _Comp_ref(__comp));
+ _VSTD::__partial_sort<_Compare>(__first, __last, __last, __comp);
return;
}
--__depth;
@@ -478,7 +477,7 @@
void __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) {
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
difference_type __depth_limit = 2 * __log2i(__last - __first);
- __introsort(__first, __last, __comp, __depth_limit);
+ _VSTD::__introsort<_Compare>(__first, __last, __comp, __depth_limit);
}
template <class _Compare, class _Tp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114133.388205.patch
Type: text/x-patch
Size: 2184 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211118/6ab3b5a0/attachment.bin>
More information about the libcxx-commits
mailing list