Returning an empty string : efficient way in c++
Gcc 7.1 -O3 these are all identical, godbolt.org/z/a-hc1d – jterm Apr 25 at 3:27 Original answer: Did some digging. Below is an example program and the relevant assembly: Code: Assembly: This was compiled with -std=c++11 -O2. You can see that there is quite a lot more work for the return “”; statement and comparably little for return std::string and return {}; (these … Read more