Optimal way to return local value in C++11
问题 In the old days, if I wanted a string representation of an object A , I would write something with the signature void to_string(const A& a, string& out) to avoid extra copies. Is this still the best practice in C++11, with move semantics and all? I have read several comments on other contexts that suggest relying on RVO and instead writing string to_string(const A& a) . But RVO is not guaranteed to happen! So, how can I, as the programmer of to_string, guarantee the string is not copied