[Bug c++/49734] Adding using std::for_each inconsistent with return value
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jul 13 14:33:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49734
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-07-13 14:29:35 UTC ---
You probably want to use the return value:
add = std::for_each(l, l + 5, add);
Although for this specific case you could #include <numeric> and use
std::accumulate
int acc = std::accumulate(c, c + 5, 0);
More information about the Gcc-bugs
mailing list