Friday, July 16, 2010

References

The initializer for a non-const T& must be a modifiable lvalue of type T; hence these two conditions are invalid
 double &rd1 = 0.0; double &rd2 = i; 
The initializer of const T& may be any type convertible to T and also it can be an rvalue; hence these two conditions are valid
 const double &rd1 = 0.0; const double &rd2 = i; 
are both valid (the compiler uses temporary objects to resolve these two conditions)

No comments:

Post a Comment