Click here to Skip to main content
15,887,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to submit (ie control) Pin
chinakknd24-Mar-08 16:14
chinakknd24-Mar-08 16:14 
GeneralSetting the cursor for MFC MDI child windows Pin
Californian222-Mar-08 12:34
Californian222-Mar-08 12:34 
GeneralRe: Setting the cursor for MFC MDI child windows Pin
Rajkumar R22-Mar-08 20:47
Rajkumar R22-Mar-08 20:47 
GeneralIcon needs to have 8 bit transparency alpahblend Pin
Member 220843722-Mar-08 10:59
Member 220843722-Mar-08 10:59 
GeneralRe: Icon needs to have 8 bit transparency alpahblend Pin
Mark Salsbery23-Mar-08 9:18
Mark Salsbery23-Mar-08 9:18 
GeneralRegGetValueA Pin
Dr. Emmett Brown22-Mar-08 5:02
Dr. Emmett Brown22-Mar-08 5:02 
GeneralRe: RegGetValueA Pin
Dr. Emmett Brown22-Mar-08 5:42
Dr. Emmett Brown22-Mar-08 5:42 
GeneralWeird C++ issue Pin
Jim Crafton22-Mar-08 4:11
Jim Crafton22-Mar-08 4:11 
I have the follwing code:

class MyStruct {
public:
	std::string s;
};


class Test {
public:
	operator std::string() const {
		return std::string();
	}

	operator void* () const {
		return NULL;
	}

	operator char () const {
		return 'a';
	}

};


It's nonsensical but bear with we. The idea is that the Test class should convert to various types, so the expression:

Test t;
std::string s = t;

compiles fine, where "s" is assigned whatever the result of Test::operator std::string().

Why then do I get compiler errors ( both on VC6 and VC8) when I do
Test t;
MyStruct m;
m.s = t;

It complains about "error C2593: 'operator =' is ambiguous"? What am I missing??!
If I remove the operator char() converter then it compiles fine. But why does this work in the first case and not the second?

¡El diablo está en mis pantalones! ¡Mire, mire!

Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!

SELECT * FROM User WHERE Clue > 0
0 rows returned

Save an Orange - Use the VCF!
VCF Blog

GeneralRe: Weird C++ issue Pin
CPallini22-Mar-08 4:36
mveCPallini22-Mar-08 4:36 
GeneralRe: Weird C++ issue Pin
Jim Crafton22-Mar-08 5:03
Jim Crafton22-Mar-08 5:03 
GeneralRe: Weird C++ issue Pin
CPallini22-Mar-08 5:13
mveCPallini22-Mar-08 5:13 
GeneralRe: Weird C++ issue Pin
Rajkumar R22-Mar-08 8:14
Rajkumar R22-Mar-08 8:14 
GeneralNon-GUI Application with small memory consumption... Pin
Shy Agam22-Mar-08 1:20
Shy Agam22-Mar-08 1:20 
QuestionRe: Non-GUI Application with small memory consumption... Pin
CPallini22-Mar-08 3:03
mveCPallini22-Mar-08 3:03 
GeneralRe: Non-GUI Application with small memory consumption... Pin
Shy Agam22-Mar-08 3:09
Shy Agam22-Mar-08 3:09 
GeneralRe: Non-GUI Application with small memory consumption... Pin
CPallini22-Mar-08 4:53
mveCPallini22-Mar-08 4:53 
GeneralRe: Non-GUI Application with small memory consumption... Pin
rp_suman22-Mar-08 3:55
rp_suman22-Mar-08 3:55 
GeneralRe: Non-GUI Application with small memory consumption... Pin
Shy Agam22-Mar-08 4:06
Shy Agam22-Mar-08 4:06 
GeneralRe: Non-GUI Application with small memory consumption... Pin
rp_suman22-Mar-08 4:17
rp_suman22-Mar-08 4:17 
GeneralRe: Non-GUI Application with small memory consumption... Pin
Shy Agam22-Mar-08 4:23
Shy Agam22-Mar-08 4:23 
GeneralRe: Non-GUI Application with small memory consumption... Pin
rp_suman22-Mar-08 4:32
rp_suman22-Mar-08 4:32 
GeneralRe: Non-GUI Application with small memory consumption... Pin
Shy Agam22-Mar-08 4:35
Shy Agam22-Mar-08 4:35 
QuestionRe: Non-GUI Application with small memory consumption... Pin
Moak22-Mar-08 4:11
Moak22-Mar-08 4:11 
GeneralRe: Non-GUI Application with small memory consumption... Pin
Shy Agam22-Mar-08 4:14
Shy Agam22-Mar-08 4:14 
GeneralRe: Non-GUI Application with small memory consumption... Pin
Moak22-Mar-08 4:31
Moak22-Mar-08 4:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.