Click here to Skip to main content
15,888,908 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionhow to detect the number key in MFC? Pin
Kingis6-Jan-09 2:46
Kingis6-Jan-09 2:46 
AnswerRe: how to detect the number key in MFC? Pin
Iain Clarke, Warrior Programmer6-Jan-09 2:56
Iain Clarke, Warrior Programmer6-Jan-09 2:56 
AnswerRe: how to detect the number key in MFC? Pin
Sarath C6-Jan-09 2:59
Sarath C6-Jan-09 2:59 
AnswerRe: how to detect the number key in MFC? Pin
John R. Shaw7-Jan-09 7:07
John R. Shaw7-Jan-09 7:07 
GeneralRe: how to detect the number key in MFC? Pin
Sarath C7-Jan-09 16:49
Sarath C7-Jan-09 16:49 
QuestionAny design pattern to manage HTTP request? Pin
kuibing6-Jan-09 2:21
kuibing6-Jan-09 2:21 
AnswerRe: Any design pattern to manage HTTP request? Pin
Randor 6-Jan-09 18:57
professional Randor 6-Jan-09 18:57 
QuestionProblem using struct as std::map value type Pin
Manfr3d6-Jan-09 1:57
Manfr3d6-Jan-09 1:57 
Hello guys,

I wanna make a map that contains an integer key and a struct as value type.

struct SRect
{
int iX, iY, iW, iH;
};
map<unsigned int=""> RectMap;

This piece of code compiles fine. However, if I want to insert a pair into the map a runtime error occurs.

void MakeParamRect(int iID, int iX, int iY, int iW, int iH)
{
RectMap[iID]->iX = iX;
RectMap[iID]->iY = iY;
RectMap[iID]->iW = iW;
RectMap[iID]->iH = iH;
}

I've also tried it using the insert() function.

RectMap.insert(make_pair(iID, {iX, iY, iW, iH}));

In this case the struct notation with the curly brackets seems to produce the error (compiler says that a semicolon is missing before the first {).

How can I make this code work, or is a struct not a valid value type for a map (it is valid in my opinion)?

Thanks for your help.
AnswerRe: Problem using struct as std::map value type Pin
Franck Paquier6-Jan-09 2:49
Franck Paquier6-Jan-09 2:49 
AnswerRe: Problem using struct as std::map value type Pin
Stuart Dootson6-Jan-09 2:57
professionalStuart Dootson6-Jan-09 2:57 
AnswerRe: Problem using struct as std::map value type Pin
Malli_S6-Jan-09 3:00
Malli_S6-Jan-09 3:00 
AnswerRe: Problem using struct as std::map value type Pin
Sarath C6-Jan-09 3:07
Sarath C6-Jan-09 3:07 
GeneralRe: Problem using struct as std::map value type Pin
Manfr3d6-Jan-09 6:37
Manfr3d6-Jan-09 6:37 
GeneralRe: Problem using struct as std::map value type Pin
Sarath C6-Jan-09 6:47
Sarath C6-Jan-09 6:47 
AnswerRe: Problem using struct as std::map value type Pin
John R. Shaw7-Jan-09 7:57
John R. Shaw7-Jan-09 7:57 
Questionabout wstring Pin
vikramlinux6-Jan-09 1:28
vikramlinux6-Jan-09 1:28 
AnswerRe: about wstring Pin
Sarath C6-Jan-09 1:44
Sarath C6-Jan-09 1:44 
GeneralRe: about wstring Pin
vikramlinux6-Jan-09 1:47
vikramlinux6-Jan-09 1:47 
AnswerRe: about wstring Pin
ThatsAlok6-Jan-09 23:51
ThatsAlok6-Jan-09 23:51 
QuestionHow to launch interactive process from Service Pin
SNI6-Jan-09 0:36
SNI6-Jan-09 0:36 
AnswerRe: How to launch interactive process from Service Pin
«_Superman_»6-Jan-09 0:50
professional«_Superman_»6-Jan-09 0:50 
AnswerRe: How to launch interactive process from Service Pin
Stuart Dootson6-Jan-09 1:01
professionalStuart Dootson6-Jan-09 1:01 
GeneralRe: How to launch interactive process from Service Pin
SNI6-Jan-09 1:16
SNI6-Jan-09 1:16 
GeneralRe: How to launch interactive process from Service Pin
Iain Clarke, Warrior Programmer6-Jan-09 1:57
Iain Clarke, Warrior Programmer6-Jan-09 1:57 
GeneralRe: How to launch interactive process from Service Pin
Stuart Dootson6-Jan-09 2:53
professionalStuart Dootson6-Jan-09 2:53 

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.