[libcxx-commits] [PATCH] D128149: [libc++][ranges] Implement `ranges::nth_element`.

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jun 19 20:11:41 PDT 2022


var-const added inline comments.


================
Comment at: libcxx/include/__algorithm/nth_element.h:32
 template<class _Compare, class _RandomAccessIterator>
-_LIBCPP_CONSTEXPR_AFTER_CXX11 bool
-__nth_element_find_guard(_RandomAccessIterator& __i, _RandomAccessIterator& __j,
-                         _RandomAccessIterator __m, _Compare __comp)
-{
-    // manually guard downward moving __j against __i
-    while (true) {
-        if (__i == --__j) {
-            return false;
-        }
-        if (__comp(*__j, *__m)) {
-            return true;  // found guard for downward moving __j, now use unguarded partition
-        }
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_AFTER_CXX11
+bool __nth_element_find_guard(_RandomAccessIterator& __i, _RandomAccessIterator& __j,
----------------
The ABI annotation was missing.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128149/new/

https://reviews.llvm.org/D128149



More information about the libcxx-commits mailing list