Click here to Skip to main content
15,886,199 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Closing of dialog box crashes application Pin
theCPkid7-Sep-09 18:31
theCPkid7-Sep-09 18:31 
GeneralRe: Closing of dialog box crashes application Pin
Le@rner7-Sep-09 18:34
Le@rner7-Sep-09 18:34 
QuestionSet the text of spincontrol( Updown control) using sendmessage Pin
Bedke7-Sep-09 18:07
Bedke7-Sep-09 18:07 
AnswerRe: Set the text of spincontrol( Updown control) using sendmessage Pin
Selvam R8-Sep-09 0:20
professionalSelvam R8-Sep-09 0:20 
GeneralRe: Set the text of spincontrol( Updown control) using sendmessage Pin
Bedke8-Sep-09 0:25
Bedke8-Sep-09 0:25 
QuestionSetWindowPos API doubt Pin
theCPkid7-Sep-09 15:47
theCPkid7-Sep-09 15:47 
AnswerRe: SetWindowPos API doubt Pin
«_Superman_»7-Sep-09 16:01
professional«_Superman_»7-Sep-09 16:01 
QuestionOverloading cast & assignment not enough for ==? Pin
dplong7-Sep-09 11:22
dplong7-Sep-09 11:22 
I wrote a generic template-based identifier class but am getting compilation errors with the is-equal operator. Anybody know how to fix this? The following code is a distillation of the problem. I get compilation errors for the conditional expressions within the assert()s. The error text in the comments is paraphrased from Visual 2008 C++ Express. I don't get these errors when the core type and the literal are an integral type, e.g., int. I assume this is due to implicit integral conversions.
#include <iostream>
#include <assert.h>

using namespace std;

class Name
{
public:
	Name(const string t_) : t(t_) { }
	Name() { }
	Name(const Name & t_) : t(t_.t) { }
	Name & operator=(const string & rhs) { t = rhs; return *this; }
	operator const string & () const { return t; }
	operator string & () { return t; }
private:
	string t;
};

int main()
{
	Name n1 = "bananas", n2 = "bananas";
	assert(n1 == n2);	// Couldn't deduce template arg for string from Name
	assert(n1 == "bananas");	// No operator found for LH operand of type Name
}

I'm thinking I need to overload the == operator. I tried that but ran into even more problems.

FWIW, my identifier class is similar to BOOST_STRONG_TYPEDEF() except that I want to be able to use the core type (possibly with implicit conversion) as an initializer to the derived type and as an argument to a derived-type parameter. I also want to use the derived type as an initializer to the core type. Here's an example of that:
BOOST_STRONG_TYPEDEF(string, S)
void f(S s) { }
int main() { S s = "abc"; f("def"); string str = s; }


Thanks!
QuestionRe: Overloading cast & assignment not enough for ==? Pin
CPallini7-Sep-09 11:54
mveCPallini7-Sep-09 11:54 
AnswerRe: Overloading cast & assignment not enough for ==? Pin
dplong7-Sep-09 12:30
dplong7-Sep-09 12:30 
AnswerRe: Overloading cast & assignment not enough for ==? Pin
Stuart Dootson7-Sep-09 14:41
professionalStuart Dootson7-Sep-09 14:41 
QuestionRe: Overloading cast & assignment not enough for ==? [modified] Pin
dplong7-Sep-09 18:39
dplong7-Sep-09 18:39 
QuestionWhy do functions in the C library have short names? Pin
0x3c07-Sep-09 10:58
0x3c07-Sep-09 10:58 
AnswerRe: Why do functions in the C library have short names? Pin
CPallini7-Sep-09 11:13
mveCPallini7-Sep-09 11:13 
AnswerRe: Why do functions in the C library have short names? Pin
dplong7-Sep-09 11:32
dplong7-Sep-09 11:32 
AnswerRe: Why do functions in the C library have short names? Pin
Richard MacCutchan7-Sep-09 11:33
mveRichard MacCutchan7-Sep-09 11:33 
AnswerRe: Why do functions in the C library have short names? Pin
Stuart Dootson7-Sep-09 14:45
professionalStuart Dootson7-Sep-09 14:45 
QuestionID_FILE_NEW causes application crashed [modified] Pin
transoft7-Sep-09 10:58
transoft7-Sep-09 10:58 
AnswerRe: ID_FILE_NEW causes application crashed Pin
Richard MacCutchan7-Sep-09 11:36
mveRichard MacCutchan7-Sep-09 11:36 
GeneralRe: ID_FILE_NEW causes application crashed Pin
transoft7-Sep-09 16:58
transoft7-Sep-09 16:58 
GeneralRe: ID_FILE_NEW causes application crashed Pin
Richard MacCutchan7-Sep-09 23:25
mveRichard MacCutchan7-Sep-09 23:25 
AnswerRe: ID_FILE_NEW causes application crashed Pin
SandipG 7-Sep-09 21:39
SandipG 7-Sep-09 21:39 
GeneralRe: ID_FILE_NEW causes application crashed Pin
transoft8-Sep-09 2:12
transoft8-Sep-09 2:12 
AnswerRe: ID_FILE_NEW causes application crashed Pin
David Crow8-Sep-09 3:31
David Crow8-Sep-09 3:31 
GeneralRe: ID_FILE_NEW causes application crashed Pin
transoft8-Sep-09 3:50
transoft8-Sep-09 3:50 

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.