typedef

Joined
Feb 12, 2008
Messages
108
Reaction score
0
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?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top