Hello everyone,
1. Returning non-const reference to function local object is not
correct. But is it correct to return const reference to function local
object?
2. If in (1), it is correct to return const reference to function
local object, the process is a new temporary object is created (based
on the function local object) and the const reference is binded to the
temporary object, and the life time of the temporary object is
extended to the life time of const reference?
Or no need to create such a temporary object, just let the const
reference binded to the function local object itself?
thanks in advance,
George