![]() ![]() ![]() | The initialization of var in a real, but simple context. | Lecture 2 - slide 18 : 42 Program 1 |
// Initializes a const reference with a rvalue. #include <iostream> #include <string> #include <cmath> typedef int T; int main(){ using namespace std; double expression = 5.3; const T &var = expression; // var becomes a reference to a rvalue // via a temporary variable. cout << var << endl; // 5 }