Proper way (move semantics) to return a std::vector from function calling in C++11
If you’re using a C++0x-compatible compiler and standard library, you get better performance from the first example without doing anything. The return value of get_vector(_n, _m) is a temporary, and the move constructor for std::vector (a constructor taking an rvalue reference) will automatically be called with no further work on your part. In general, non-library … Read more