aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h
diff options
context:
space:
mode:
authorarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-02-15 15:15:56 +0300
committerarcadia-devtools <arcadia-devtools@yandex-team.ru>2022-02-15 15:15:56 +0300
commitf9211a752e27e7a9915c4ab07d73c86089a3f1c9 (patch)
tree378892948f101a885a6b356954f8442e4c68aa93 /contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h
parent9846e9a3b6d37890eb5868e4cce0d1b927d49418 (diff)
downloadydb-f9211a752e27e7a9915c4ab07d73c86089a3f1c9.tar.gz
intermediate changes
ref:6047a064234457e5084bb81c38d0758e4de103c3
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h')
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h
index bec6355ba9..63feba1ea6 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/nth_element.h
@@ -16,6 +16,10 @@
#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
@@ -222,8 +226,13 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
void
nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp)
{
- typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
- _VSTD::__nth_element<_Comp_ref>(__first, __nth, __last, __comp);
+ _LIBCPP_DEBUG_RANDOMIZE_RANGE(__first, __last);
+ typedef typename __comp_ref_type<_Compare>::type _Comp_ref;
+ _VSTD::__nth_element<_Comp_ref>(__first, __nth, __last, __comp);
+ _LIBCPP_DEBUG_RANDOMIZE_RANGE(__first, __nth);
+ if (__nth != __last) {
+ _LIBCPP_DEBUG_RANDOMIZE_RANGE(++__nth, __last);
+ }
}
template <class _RandomAccessIterator>