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

Marshall Clow via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 1 17:51:49 PDT 2019


mclow.lists added inline comments.


================
Comment at: include/numeric:166
     for (; __first != __last; ++__first)
-        __init = __init + *__first;
+        __init = _VSTD::move(__init) + *__first;
     return __init;
----------------
This move stuff should be enabled for C++20 and later, not for older standards. This is a new feature (a paper), not a bug fix (an issue).

So you need to do this:
```
#if _LIBCPP_STD_VER > 17
     __init = _VSTD::move(__init) + *__first;
#else
     __init = __init + *__first;
#endif
```

and the move-enabled tests should be post-C++17.

Note that we never test for an unreleased standard version. We only say "greater than 17", not "20" - because something might happen, and there might not be a C++20. It might slip to 2021, say.



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

https://reviews.llvm.org/D61170





More information about the libcxx-commits mailing list