operator ' is ambiguous
Hi ,any time i try using cout<< unsigned __int64value i get an operator << is ambigous.
A solution would be to use printf but this is so so C like.
Any ideas? [smile]
Were you actually literally trying some statement like "cout << unsigned __int64 value;", or do you mean
?
The first won't work. At all. The second will work if your compiler is not lame. If it doesn't work, your compiler is lame. [wink]
unsigned __int64 value;cout << value;
?
The first won't work. At all. The second will work if your compiler is not lame. If it doesn't work, your compiler is lame. [wink]
Quote:Original post by DocOr you are using the wrong header.
The second will work if your compiler is not lame. If it doesn't work, your compiler is lame. [wink]
unsigned __int64 isn't a standard C++ type, therefore your compiler's headers probably do not overload << for it to work with the ostream templates. No, this doesn't mean your compiler is bad -- it's perfectly fine. You get ambiguity because an unsigned __int64 can be converted to a standard C++ type that does have an overloaded <<. For instance, usigned __int64 can be probably be implicitly converted to either an unsigned long or an unsigned int or an unsigned short or an unsigned char, all of which have an associated operator << overloaded to work with the ostream templates so it's ambiguous as to which one it should convert to. So, either overload << for unsigned __int64 to work with ostream or explicitly typecast your value to a standard C++ type which has an overloaded << to work with ostream.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement