[libcxx-commits] [PATCH] D61170: Use std::move in numeric algorithms

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Apr 27 12:56:23 PDT 2019


zoecarver marked 3 inline comments as done.
zoecarver added a comment.

Thanks for the help and example @mclow.lists. That cleared it up a lot, hope this update fixes the issues and provides a test for the example you gave.



================
Comment at: include/numeric:416
 _OutputIterator
 adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
 {
----------------
While updating this function, I changed the variable names so it could more easily be read. If you want, I am happy to change them back.


================
Comment at: include/numeric:425
+            typename iterator_traits<_InputIterator>::value_type __val(*__first);
+            *__result = __val - _VSTD::move(__acc);
+            __acc = _VSTD::move(__val);
----------------
I can't find a good way to test that `__acc` is not read after being moved but before being re-assigned. If you have any ideas, let me know. Otherwise, I think it will be okay as-is. 


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

https://reviews.llvm.org/D61170





More information about the libcxx-commits mailing list