Quote:
Consider:
double & dr = 1; // error: l-value needed
const double & cdr = 1; // ok
The Interpretation of this last initialization might be:
double temp = double(1);
const double & cdr = temp;
A temporary created to hold a reference initializer persists until the end of its reference's scope.
References to variables and references to constants are distinguished because the introduction of a temporary in the case of the variable is highly error-prone; an assignment to the variable would become an assignment to the -- soon to disappear -- temporary. No such problem exists for references to constants and references to constants are often important as function arguments. [...]
I'm not sure if in the case of returning a const & too will be created a temporary.