Sorry my English is not very good. You mean there is no way to check whether insert a new element or overwriting existing element if we use  operator?
If the argument key value is not found, then it is inserted along with the default value of the data type.
operator may be used to insert elements into a map m using m[_Key] = DataValue; where DataValue is the value of the mapped_type of the element with a key value of _Key.
When using operator to insert elements, the returned reference does not indicate whether an insertion is changing a pre-existing element or creating a new one. The member functions find and insert can be used to determine whether an element with a specified key is already present before an insertion.
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
When using mapvariable[somekey] = somevalue to insert into a map variable, how to check whether there is conflicting key value in the map in an elegant way?
You can use map::find() to check whether the key is already present in map. Well, the  operator will overwrite the existing entry if the key already exists.
OT: Be a little careful while using  operator with map, especially while reading from map. For instance, if you try to get a key-value which is not in map, it create a new entry and return the default value. For instance,
// An empty map.
// If you lookup a for a key which is not present,// it will create empty entry and return. It won't// throw any error.
CString LookupKey = _T("key"); // Key which is not present.
CString Value = TempMap[LookupKey];
Good to know that. Previously I wrongly think we can check whether the expression mapvariable[somekey] returns null or not to check whether the element exists. Now I think I am wrong, and using find is the optimum solution to check existence, and using  could never tell us whether we insert new pair or overwriting an old pair, all are correct understanding?
I am attempting to access the file names as they get displayed in the listview of the Common File Dialog and change the file name text in certain ways. I was able to do this when the listview was not of style Ownerdata (which seems to be in XP), but in Vista they seem to be of style Ownerdata and I am not able to do a SetItemText anymore. Has anyone done something like this, and can help?
Yes, you are right. Thats my problem. I have a similar function that shows all the bands in a list.
I'm able to show all the musics from a band... I use: band->show_availavle__music() This gives me the music from that specific band.
But I want an option to show all the musics from all the bands. I mean, all the objects( music) from all the correspondent objects (band).
I'm not sure i understand that.. Can you give me an example?
This is the code I have to display the music from ONE specific Band:
cout<<"Whats the name of the band you want to search music from? ";
band = myManager.select_band_name(name);
cout << "List of " << name <<"'s music.\n" << endl;
for ( it=available_music_list.begin() ; it != available_music_list.end(); it++ )
cout << *it << endl;
But what of the function you mentioned that "shows all the bands in a list?" Much like select_band_name() returns a single Band object, you need a function that returns a Band object based on an index or an iterator. That way you could use it in a loop.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
I have a lab assignment in my C++ class that asks me to do the following:
-Create an application that prompts the user for two 3-digit numbers, then display the result in the following format:
The problem I am having is the method I'm trying to use. I am using the carry over technique, and I need a way to split up the 3-digit numbers into single numbers, then multiply/carry/add accordingly
Anything unclear let me know,
Last Visit: 31-Dec-99 18:00 Last Update: 26-May-22 5:45