https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109333
Bug ID: 109333
Summary: Use std::move in std::accumulate etc. for std::string
for C++11/14/17
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0616r0.pdf changed
some <numeric> algos to use std::move for the accumulator, which is an
observable semantic change. For that reason, we only implement the change for
C++20 and up, to retain the behaviour specified in earlier standards.
If the accumulator is std::string then we know it's not observable, and so we
can improve performance by always moving (except in C++98 mode).