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

Marshall Clow via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 26 07:12:50 PDT 2019


mclow.lists added a comment.

Consider the following code:

  std::vector<std::string> v = { "abc", "def", "ghi", "jkl", "mno" };
  std::vector<std::string> r = { "xxx", "xxx", "xxx", "xxx", "xxx" };
  std::partial_sum(v.begin(), v.end(), r.begin());
  for (const auto &s: r) std::cout << s << "|";
  std::cout << std::endl;

With the current implementation of `partial_sum`, this prints: `abc|abcdef|abcdefghi|abcdefghijkl|abcdefghijklmno|`
With your changes, it prints: `abc|def|ghi|jkl|mno|`


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D61170





More information about the libcxx-commits mailing list