aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/__algorithm/partial_sort.h
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include/__algorithm/partial_sort.h')
-rw-r--r--libcxx/include/__algorithm/partial_sort.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/libcxx/include/__algorithm/partial_sort.h b/libcxx/include/__algorithm/partial_sort.h
index 4f9872c4922b..622624ec4f42 100644
--- a/libcxx/include/__algorithm/partial_sort.h
+++ b/libcxx/include/__algorithm/partial_sort.h
@@ -18,13 +18,14 @@
#include <__iterator/iterator_traits.h>
#include <__utility/swap.h>
+#if defined(_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY)
+# include <__algorithm/shuffle.h>
+#endif
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
-_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Compare, class _RandomAccessIterator>
@@ -51,8 +52,10 @@ void
partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
_Compare __comp)
{
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- _VSTD::__partial_sort<_Comp_ref>(__first, __middle, __last, __comp);
+ _LIBCPP_DEBUG_RANDOMIZE_RANGE(__first, __last);
+ typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
+ _VSTD::__partial_sort<_Comp_ref>(__first, __middle, __last, __comp);
+ _LIBCPP_DEBUG_RANDOMIZE_RANGE(__middle, __last);
}
template <class _RandomAccessIterator>
@@ -66,6 +69,4 @@ partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Ran
_LIBCPP_END_NAMESPACE_STD
-_LIBCPP_POP_MACROS
-
#endif // _LIBCPP___ALGORITHM_PARTIAL_SORT_H