Don't return by const value. At best, it does nothing. At worst, it confuses the optimizer.
Printable View
Don't return by const value. At best, it does nothing. At worst, it confuses the optimizer.
And do not return reference to static local var from function that may be used in multithreading envirounment
Avoid returning any static local var, I say. If so, create them on the heap.
That's my opinion, though. Though the example illustrates the purpose in the simplest of ways.