![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Basic facilities - slide 18 : 42 |
A constant reference is really a reference to a constant
"An initializer for const T& does not need to be an lvalue, or even of type T."
const T &var = expression;
![]() | A similar program that initializes a user defined struct via a 'functional casting' constructor. |
![]() | An envelope around the stdlib div function that returns a struct of quotient and remainder. |
![]() | Ways of returning results from the div function |
![]() | A similar setup - illustrates that it is not good to return a reference to a deallocated local variable. |