Don't return by const value. At best, it does nothing. At worst, it confuses the optimizer.
This is a discussion on returning reference from class within the C++ Programming forums, part of the General Programming Boards category; Don't return by const value. At best, it does nothing. At worst, it confuses the optimizer....
Don't return by const value. At best, it does nothing. At worst, it confuses the optimizer.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
And do not return reference to static local var from function that may be used in multithreading envirounment
The first 90% of a project takes 90% of the time,
the last 10% takes the other 90% of the time.
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.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^