Click here to Skip to main content
15,173,985 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Help with launching modal-less dialog error Pin
Nibu babu thomas27-Aug-08 19:51
MemberNibu babu thomas27-Aug-08 19:51 
AnswerRe: Help with launching modal-less dialog error Pin
limesp27-Aug-08 20:57
Memberlimesp27-Aug-08 20:57 
QuestionInsert into map Pin
George_George27-Aug-08 18:58
MemberGeorge_George27-Aug-08 18:58 
AnswerRe: Insert into map Pin
Nibu babu thomas27-Aug-08 19:32
MemberNibu babu thomas27-Aug-08 19:32 
GeneralRe: Insert into map Pin
George_George27-Aug-08 20:35
MemberGeorge_George27-Aug-08 20:35 
GeneralRe: Insert into map Pin
Nibu babu thomas27-Aug-08 20:38
MemberNibu babu thomas27-Aug-08 20:38 
GeneralRe: Insert into map Pin
George_George27-Aug-08 20:42
MemberGeorge_George27-Aug-08 20:42 
GeneralRe: Insert into map Pin
Nibu babu thomas27-Aug-08 20:49
MemberNibu babu thomas27-Aug-08 20:49 
George_George wrote:
using [] could never tell us whether we insert new pair or overwriting an old pair


Yes IMO!

Source code for [] operator of std::map looks likewise...

mapped_type& operator[](const key_type& _Keyval)
     {	
           // find element matching _Keyval or insert with default mapped
	   iterator _Where = this->lower_bound(_Keyval);
           if ( _Where == this->end() || 
                this->comp(_Keyval, this->_Key(_Where._Mynode())))
			_Where = this->insert(_Where,
				value_type(_Keyval, mapped_type()));
		return ((*_Where).second);
     }


Take a look at the comment line and the return value, so we can't find out whether we have one or we don't have one, unless we do an explicit find. Also note that it's returning a reference.


George_George wrote:
I am so bad to express my idea and question.


Could be my problem too. Wink | ;)


Nibu babu thomas
Microsoft MVP for VC++


Code must be written to be read, not by the compiler, but by another human being.

Programming Blog: http://nibuthomas.wordpress.com

GeneralRe: Insert into map Pin
George_George27-Aug-08 20:57
MemberGeorge_George27-Aug-08 20:57 
GeneralRe: Insert into map Pin
Nibu babu thomas27-Aug-08 21:21
MemberNibu babu thomas27-Aug-08 21:21 
GeneralRe: Insert into map Pin
George_George27-Aug-08 21:48
MemberGeorge_George27-Aug-08 21:48 
AnswerRe: Insert into map Pin
Jijo.Raj27-Aug-08 19:58
MemberJijo.Raj27-Aug-08 19:58 
GeneralRe: Insert into map Pin
George_George27-Aug-08 20:39
MemberGeorge_George27-Aug-08 20:39 
GeneralRe: Insert into map Pin
Jijo.Raj27-Aug-08 21:05
MemberJijo.Raj27-Aug-08 21:05 
GeneralRe: Insert into map Pin
George_George27-Aug-08 21:49
MemberGeorge_George27-Aug-08 21:49 
Questionmulity line edit control Pin
ani_ikram27-Aug-08 18:53
Memberani_ikram27-Aug-08 18:53 
AnswerRe: mulity line edit control Pin
Naveen27-Aug-08 19:20
MemberNaveen27-Aug-08 19:20 
GeneralRe: mulity line edit control Pin
ani_ikram27-Aug-08 20:01
Memberani_ikram27-Aug-08 20:01 
QuestionRe: mulity line edit control Pin
David Crow28-Aug-08 4:59
MemberDavid Crow28-Aug-08 4:59 
QuestionCArray::RemoveAt() causes Unhandled exception Pin
rp_suman27-Aug-08 17:13
Memberrp_suman27-Aug-08 17:13 
QuestionRe: CArray::RemoveAt() causes Unhandled exception Pin
Mark Salsbery28-Aug-08 7:16
MemberMark Salsbery28-Aug-08 7:16 
QuestionChanging the filenames in the Common File Dialog Pin
Tony Rowe27-Aug-08 15:51
MemberTony Rowe27-Aug-08 15:51 
Questionstl::list --- Issue using lists.. Pin
FrankMookie27-Aug-08 14:22
MemberFrankMookie27-Aug-08 14:22 
QuestionRe: stl::list --- Issue using lists.. Pin
Maximilien27-Aug-08 14:32
MemberMaximilien27-Aug-08 14:32 
AnswerRe: stl::list --- Issue using lists.. Pin
FrankMookie27-Aug-08 14:42
MemberFrankMookie27-Aug-08 14:42 

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.