Re: Ambiguous conversions
Re: Ambiguous conversions
- Subject: Re: Ambiguous conversions
- From: David Dunham <email@hidden>
- Date: Fri, 23 Jun 2006 11:33:21 -0700
On 23 Jun 2006, at 10:33, Mark Wagner wrote:
It's not the constant that's the problem. Here's a code sample that
demonstrates what's going on:
class MString
{
public:
MString( const char* str , long length );
operator const char*( void ) const;
operator const wchar_t* (void ) const;
operator const unsigned char*( void ) const;
const wchar_t& operator[]( long index ) const;
};
int main(void)
{
MString str("test", 5);
return str[2]; // <-- Error occurs here
}
Is there any way to fix this, preferably without removing the
typecasts from the class, and without changing the 1,800 lines of code
where the error is occuring? Say, with a minor tweak to the class, or
by telling the compiler to go back to its old behavior?
My guess is: why does this take char, but return wchar_t? Could you add
const char& operator[]( long index ) const;
------------
David Dunham email@hidden http://www.pensee.com/dunham/
"No matter how far you have gone on a wrong road, turn back." -
Turkish proverb
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden