[libcxx-commits] [PATCH] D118003: [libc++] Floyd's improvement to pop_heap

Eric Fiselier via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 8 17:27:30 PST 2022


EricWF added inline comments.


================
Comment at: libcxx/include/__algorithm/sift_down.h:83
+    using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type;
+    _LIBCPP_ASSERT(__len >= 2, "shouldn't be called unless __len >= 2");
+
----------------
LIBCPP_ASSERT is not meant to guard against internal library logic errors. 


================
Comment at: libcxx/include/__algorithm/sift_down.h:101
+        *__hole = std::move(*__child_i);
+        __hole = std::move(__child_i);
+
----------------
You move __child_i here, but you reference it again at the start of the next loop iteration


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118003



More information about the libcxx-commits mailing list