When to return a pointer, scalar and reference in C++?
Return by value. The compiler can optimize away the copy, so the end result is what you want. An object is created, and returned to the caller. I think the reason why you rarely see people do this is because you’re looking at the wrong C++ code. 😉 Most people coming from Java feel uncomfortable … Read more