Click here to Skip to main content
15,942,847 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: timer does not start Pin
Richard Andrew x646-Jul-24 9:48
professionalRichard Andrew x646-Jul-24 9:48 
QuestionAfxRegisterWndClass crashes when called again Pin
etechX212-Jun-24 20:07
etechX212-Jun-24 20:07 
AnswerRe: AfxRegisterWndClass crashes when called again Pin
Victor Nijegorodov12-Jun-24 20:24
Victor Nijegorodov12-Jun-24 20:24 
GeneralRe: AfxRegisterWndClass crashes when called again Pin
etechX212-Jun-24 21:58
etechX212-Jun-24 21:58 
GeneralRe: AfxRegisterWndClass crashes when called again Pin
Victor Nijegorodov13-Jun-24 5:17
Victor Nijegorodov13-Jun-24 5:17 
GeneralRe: AfxRegisterWndClass crashes when called again Pin
etechX213-Jun-24 18:40
etechX213-Jun-24 18:40 
GeneralRe: AfxRegisterWndClass crashes when called again Pin
Victor Nijegorodov13-Jun-24 19:59
Victor Nijegorodov13-Jun-24 19:59 
QuestionInserting a user defined key in a C++ map Pin
Amrit Agr10-Jun-24 8:23
Amrit Agr10-Jun-24 8:23 
Hi Guys,

I have recently came across one scenario where I have to insert a user defined key in a c++ map. that class looks like this

class key
{
int id;
string name;
};

map is like map<key,int>

I'll overload "operator<" function and will sort out based on "id" which will works fine, but the condition is like, if there are 2 entry with same ID but with a different name, for ex. {"50", Jack} and {"50", John}

As both the values have SAME ID and different name, map should make an entry for both.

Only in the case of combination of same ID and same name, it shouldn't allow the entry.

bool operator<(key& temp)
{
if(id < temp.id)
{
return true;
}
if( id == temp.id)
return name < temp.name;
}

its not working properly, its overriding the last entry if same ID is there.

Please help me out

-- modified 10-Jun-24 15:02pm.
AnswerRe: Inserting a user defined key in a C++ map Pin
Daniel Pfeffer10-Jun-24 8:44
professionalDaniel Pfeffer10-Jun-24 8:44 
QuestionC++, epiphanies, article content ideas Pin
honey the codewitch7-Jun-24 20:28
mvahoney the codewitch7-Jun-24 20:28 
GeneralRe: C++, epiphanies, article content ideas Pin
k50548-Jun-24 2:10
mvek50548-Jun-24 2:10 
GeneralRe: C++, epiphanies, article content ideas Pin
honey the codewitch8-Jun-24 3:40
mvahoney the codewitch8-Jun-24 3:40 
GeneralRe: C++, epiphanies, article content ideas Pin
trønderen8-Jun-24 5:05
trønderen8-Jun-24 5:05 
AnswerRe: C++, epiphanies, article content ideas Pin
jschell12-Jun-24 14:59
jschell12-Jun-24 14:59 
GeneralRe: C++, epiphanies, article content ideas Pin
honey the codewitch12-Jun-24 15:03
mvahoney the codewitch12-Jun-24 15:03 
GeneralRe: C++, epiphanies, article content ideas Pin
jschell13-Jun-24 12:33
jschell13-Jun-24 12:33 
GeneralRe: C++, epiphanies, article content ideas Pin
honey the codewitch13-Jun-24 12:37
mvahoney the codewitch13-Jun-24 12:37 
GeneralRe: C++, epiphanies, article content ideas Pin
jschell14-Jun-24 13:15
jschell14-Jun-24 13:15 
PraiseI never fail to be impressed by this Pin
honey the codewitch7-Jun-24 5:44
mvahoney the codewitch7-Jun-24 5:44 
QuestionPassing a class (pointer) to library - Linux Pin
Salvatore Terress31-May-24 9:00
Salvatore Terress31-May-24 9:00 
AnswerRe: Passing a class (pointer) to library - Linux Pin
k505431-May-24 10:25
mvek505431-May-24 10:25 
GeneralBUMP Re: Passing a class (pointer) to library - Linux Pin
Salvatore Terress31-May-24 14:12
Salvatore Terress31-May-24 14:12 
GeneralRe: Passing a class (pointer) to library - Linux Pin
Richard MacCutchan1-Jun-24 1:47
mveRichard MacCutchan1-Jun-24 1:47 
GeneralRe: BUMP Re: Passing a class (pointer) to library - Linux Pin
Richard MacCutchan4-Jun-24 2:02
mveRichard MacCutchan4-Jun-24 2:02 
QuestionHow C++ manage memory in event driven system ? Pin
Salvatore Terress30-May-24 4:44
Salvatore Terress30-May-24 4:44 

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.