std::map and error checking
-
Windows 7, Visual Studio 2008, MFC, C++, Dialog My application makes use of an std::map, inserting records with the following:
m_tmats_definition_map[ the_key ] = m_one_definition_record;
the_key is a CString and m_one_definition_record is a structure of several CStrings and a few various fields such as integers. That seems to be working. Now in the event something does not work out right I want some error checking. I am not finding much of anything concerning run time checking on this insert operation. Probably not looking in the right places or using the right search phrase. Where can I look to find a good discussion on this topic?
Thanks for your time If you work with telemetry, please check this bulletin board: http://www.bkelly.ws/irig\_106/
-
Windows 7, Visual Studio 2008, MFC, C++, Dialog My application makes use of an std::map, inserting records with the following:
m_tmats_definition_map[ the_key ] = m_one_definition_record;
the_key is a CString and m_one_definition_record is a structure of several CStrings and a few various fields such as integers. That seems to be working. Now in the event something does not work out right I want some error checking. I am not finding much of anything concerning run time checking on this insert operation. Probably not looking in the right places or using the right search phrase. Where can I look to find a good discussion on this topic?
Thanks for your time If you work with telemetry, please check this bulletin board: http://www.bkelly.ws/irig\_106/
ouch - hard question - I just had a look and its a right PITA - 'Dinkumware' and SGI used to have good manuals (and even finding what exceptions are thrown within is hard enough) SGI's manual page for MAP is ... http://www.sgi.com/tech/stl/Map.html[^] that may give you a start point - what sort of error's do you expect ? dont forget that map doesnt throw an error for a duplicate key value (the commonest issue I guess) - it simply replaces the existing value... for that reason, you should use find() first on the map to see if the value already exists 'g'
-
ouch - hard question - I just had a look and its a right PITA - 'Dinkumware' and SGI used to have good manuals (and even finding what exceptions are thrown within is hard enough) SGI's manual page for MAP is ... http://www.sgi.com/tech/stl/Map.html[^] that may give you a start point - what sort of error's do you expect ? dont forget that map doesnt throw an error for a duplicate key value (the commonest issue I guess) - it simply replaces the existing value... for that reason, you should use find() first on the map to see if the value already exists 'g'
I don't know what sort of errors to expect. Isn't that one of the joys of software? Good link. Good point with the Find(). I do want to know if there are duplicates and will incorporate that.
Thanks for your time If you work with telemetry, please check this bulletin board: http://www.bkelly.ws/irig\_106/
-
Windows 7, Visual Studio 2008, MFC, C++, Dialog My application makes use of an std::map, inserting records with the following:
m_tmats_definition_map[ the_key ] = m_one_definition_record;
the_key is a CString and m_one_definition_record is a structure of several CStrings and a few various fields such as integers. That seems to be working. Now in the event something does not work out right I want some error checking. I am not finding much of anything concerning run time checking on this insert operation. Probably not looking in the right places or using the right search phrase. Where can I look to find a good discussion on this topic?
Thanks for your time If you work with telemetry, please check this bulletin board: http://www.bkelly.ws/irig\_106/
-
Windows 7, Visual Studio 2008, MFC, C++, Dialog My application makes use of an std::map, inserting records with the following:
m_tmats_definition_map[ the_key ] = m_one_definition_record;
the_key is a CString and m_one_definition_record is a structure of several CStrings and a few various fields such as integers. That seems to be working. Now in the event something does not work out right I want some error checking. I am not finding much of anything concerning run time checking on this insert operation. Probably not looking in the right places or using the right search phrase. Where can I look to find a good discussion on this topic?
Thanks for your time If you work with telemetry, please check this bulletin board: http://www.bkelly.ws/irig\_106/
In this case, there's nothing you need to do. If something goes wrong, it'll throw a C++ exception. Most likely causes will be that a new element can't be constructed, or that there is insufficient memory. But maybe this is not what you meant. You say you want error checking; why do you want error checking? What is that you want to accomplish? Perhaps the solution is different.