Hello everyone,
In the following segment, it does not compile because const is qualified on (the whole) type int& not on the near one int, right?
thanks in advance,
George
In the following segment, it does not compile because const is qualified on (the whole) type int& not on the near one int, right?
Code:
#include <iostream>
using namespace std;
typedef const int& rcInt;
typedef int& int_ref_t;
int main()
{
rcInt ref = 0; // compile ok
const int_ref_t x = 0; // error C2440: 'initializing' : cannot convert from 'int' to 'int_ref_t'
return 0;
}
thanks in advance,
George