Is it valid to store the return value of an object in a reference?
class A { ... }; A myFunction() { A myObject; return myObject; } //myObject goes o
It is not allowed to bind the temporary to a non-const reference, but if you make your reference const you will extend the lifetime of the temporary to the reference, see this Danny Kalev post about it.
In short:
const A& mySecondObject = myFunction();