Click here to Skip to main content
15,910,981 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionChanging menus in MDI ( MFC) Pin
Like2Byte12-Feb-09 10:02
Like2Byte12-Feb-09 10:02 
QuestionNeed help on MCI functions Pin
John50212-Feb-09 9:32
John50212-Feb-09 9:32 
QuestionImpersonation via network Pin
Green Fuze12-Feb-09 9:09
Green Fuze12-Feb-09 9:09 
QuestionReadFile/WriteFile returning ERROR_INVALID_FUNCTION on USB device on Vista Pin
Keith Worden12-Feb-09 5:12
Keith Worden12-Feb-09 5:12 
AnswerRe: ReadFile/WriteFile returning ERROR_INVALID_FUNCTION on USB device on Vista Pin
Stuart Dootson12-Feb-09 6:59
professionalStuart Dootson12-Feb-09 6:59 
GeneralRe: ReadFile/WriteFile returning ERROR_INVALID_FUNCTION on USB device on Vista Pin
Keith Worden13-Feb-09 0:06
Keith Worden13-Feb-09 0:06 
GeneralRe: ReadFile/WriteFile returning ERROR_INVALID_FUNCTION on USB device on Vista Pin
Stuart Dootson13-Feb-09 0:17
professionalStuart Dootson13-Feb-09 0:17 
QuestionTCHAR as Key in a map. Pin
Comp_Users12-Feb-09 1:28
Comp_Users12-Feb-09 1:28 
Hi,

In the application that I am developing, I wants to store a list(using map) of structures.
Here I want the key to be an array of wide characters i.e of type TCHAR.

typedef struct
{
  int nID;
  int somedata;
}MyStruct;

The structure list would be of the form.
typedef std::map<tchar mystruct=""> MyStructMap;
MyStructMap objStructMap;</tchar>


I want to filling the map using a key of type TCHAR which will uniquely identify each instance of the struct that is inserted.


The place where I am inserting an structure with an unique TCHAR key is as follows.

Mystruct structobj1;
structobj1.nID = 100;
structobj2.somedata = 253;

objStructMap.insert(MyStructMap::value_type(_T("Unique1"),  structobj1)).second;
//Do the above line multiple number of times for different keys and struct object values.


The Insert operation mentioned above is failing with error

error C2665: 'std::pair<_Ty1,_Ty2>::pair' : none of the 3 overloads could convert all the argument types	e:\vc05\sam\MyApp\MyApp.cpp	398
error C2228: left of '.second' must have class/struct/union	e:\vc05\sam\MyApp\MyApp.cpp	398


I could you an pointer to a TCHAR as a Key for the map, but don't want to do that because I have to create an object on the heap and dont want to do that.


Is my technique of inseting an TCHAR array and struct pair in the map object briefed above correct?

Please point the cause of the error.
GeneralRe: TCHAR as Key in a map. Pin
liangyenchyen12-Feb-09 1:40
liangyenchyen12-Feb-09 1:40 
GeneralRe: TCHAR as Key in a map. Pin
Comp_Users12-Feb-09 2:05
Comp_Users12-Feb-09 2:05 
AnswerRe: TCHAR as Key in a map. Pin
Stuart Dootson12-Feb-09 2:23
professionalStuart Dootson12-Feb-09 2:23 
GeneralRe: TCHAR as Key in a map. Pin
Comp_Users12-Feb-09 3:26
Comp_Users12-Feb-09 3:26 
AnswerRe: TCHAR as Key in a map. Pin
Cedric Moonen12-Feb-09 2:27
Cedric Moonen12-Feb-09 2:27 
AnswerRe: TCHAR as Key in a map. Pin
Eytukan12-Feb-09 2:58
Eytukan12-Feb-09 2:58 
QuestionEclipse C++ Project references Pin
gvanto12-Feb-09 1:07
gvanto12-Feb-09 1:07 
AnswerRe: Eclipse C++ Project references Pin
Stuart Dootson12-Feb-09 2:11
professionalStuart Dootson12-Feb-09 2:11 
AnswerRe: Eclipse C++ Project references Pin
CPallini12-Feb-09 2:17
mveCPallini12-Feb-09 2:17 
GeneralRe: Eclipse C++ Project references [modified] Pin
gvanto12-Feb-09 12:16
gvanto12-Feb-09 12:16 
AnswerRe: Eclipse C++ Project references Pin
gvanto12-Feb-09 13:31
gvanto12-Feb-09 13:31 
Questionmessage loop + event Pin
Vlasta_12-Feb-09 0:16
Vlasta_12-Feb-09 0:16 
AnswerRe: message loop + event Pin
Stuart Dootson12-Feb-09 0:33
professionalStuart Dootson12-Feb-09 0:33 
AnswerRe: message loop + event Pin
Stephen Hewitt12-Feb-09 0:44
Stephen Hewitt12-Feb-09 0:44 
AnswerRe: message loop + event Pin
Vlasta_12-Feb-09 1:46
Vlasta_12-Feb-09 1:46 
QuestionBest sleep() method in while loop? Pin
notiter12-Feb-09 0:15
notiter12-Feb-09 0:15 
AnswerRe: Best sleep() method in while loop? Pin
_AnsHUMAN_ 12-Feb-09 0:26
_AnsHUMAN_ 12-Feb-09 0:26 

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.