[libcxx-commits] [PATCH] D67273: [libc++] Remove unnecessary assignment in exclusive_scan

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 6 06:20:27 PDT 2019


ldionne created this revision.
ldionne added a reviewer: wash.
Herald added a reviewer: EricWF.
Herald added subscribers: libcxx-commits, dexonsmith, jkorous, christof.
Herald added a project: libc++.

Reported in https://twitter.com/blelbach/status/1169807347142676480


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67273

Files:
  libcxx/include/numeric


Index: libcxx/include/numeric
===================================================================
--- libcxx/include/numeric
+++ libcxx/include/numeric
@@ -308,13 +308,12 @@
 {
     if (__first != __last)
     {
-        _Tp __saved = __init;
         do
         {
-            __init = __b(__init, *__first);
-            *__result = __saved;
-            __saved = __init;
+            _Tp __tmp = __b(__init, *__first);
+            *__result = __init;
             ++__result;
+            __init = _VSTD::move(__tmp);
         } while (++__first != __last);
     }
     return __result;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67273.219089.patch
Type: text/x-patch
Size: 593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190906/6e0b2059/attachment.bin>


More information about the libcxx-commits mailing list