3 ms·
All modern C++ compilers support RVO, so there will be no copy given how this function is implemented. If by "safer" you mean "probably faster", then that's not
by alexkcd 14y ago
All modern C++ compilers support RVO, so there will be no copy given how this function is implemented. If by "safer" you mean "probably faster", then that's not true:
http://cpp-next.com/archive/2009/08/want-speed-pass-by-value/ http://cpp-next.com/archive/2009/08/want-speed-pass-by-value...
The author's version is more idiomatic modern C++, while your version is something you'd write for a decade old compiler.