[PATCH] D26991: Hoist redundant load

Marshall Clow via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 29 06:05:54 PST 2016


mclow.lists requested changes to this revision.
mclow.lists added inline comments.
This revision now requires changes to proceed.


================
Comment at: libcxx/include/algorithm:1499
+    // Load the first element from __first2 outside the loop because it is loop invariant
+    typename iterator_traits<_RandomAccessIterator1>::value_type __firstElement2 = *__first2;
+
----------------
I just realized that we can't do this.
This imposes a requirement that the `value_type` be copy-constructible.

With this in place, we can't search a sequence of move-only types.


https://reviews.llvm.org/D26991





More information about the cfe-commits mailing list