Windows XP Pro, Visual Studio 2008.
I created some test code at home using std::map (Windows 7, visual studio 2008) and it worked fine. Back at work I cannot get past step 2. (step 1 is write code and compile) It appears that the map delcaration is okay and the code compiles, but when I do anything with the map an exception is thown. Here is the declaration:
MSG_STRUCT * p_msg;
The structure is defined earlier in the same h file. In the code the exception was thrown when I tried either of these:
I have edited the code to try to catch everything and now have the following:
when I step through with the debugger an expception is thrown. I wind up here in file xtree (opened by VS):
I found the "std::exception & e" with some searches and thought that with that catch, followed by catch(...) I would have a chance it figuring out what is wrong. Something is fundamentally wrong with my declaration but I don't know where to look.
My work computer is in an isolated room and I cannot cut and paste. Please excuse any typos that I have probably made. The code compiles and starts up, the structure is created using the pointer and populated with some data, then when I attempt to do anything with the map, the exception is thown.
I need some clues.
We need to know what a dragon is
before we study its anatomy.
(Bryan Kelly, 2010)
I created some test code at home using std::map (Windows 7, visual studio 2008) and it worked fine. Back at work I cannot get past step 2. (step 1 is write code and compile) It appears that the map delcaration is okay and the code compiles, but when I do anything with the map an exception is thown. Here is the declaration:
Code:
std::map< int, MSG_STRUCT * > msg_map;
std::map< int, MSG_STRUCT * >::iterator msg_iter;
The structure is defined earlier in the same h file. In the code the exception was thrown when I tried either of these:
Code:
msg_map.clear();
msg_map[ index ] = p_msg;
I have edited the code to try to catch everything and now have the following:
Code:
Cstring t_string;
try
{
msg_iter = msg_map.begin(); // an arbitrary selection
}
{
catch( std::exception & e )
{
t_string.Format( L" %s ", e.what() );
}
catch( ... )
{
t_string.Format ( L"huh?");
}
when I step through with the debugger an expception is thrown. I wind up here in file xtree (opened by VS):
Code:
iterator begin()
{
return (TREE_ITERATOR( )_Lmost() ) );
}
I found the "std::exception & e" with some searches and thought that with that catch, followed by catch(...) I would have a chance it figuring out what is wrong. Something is fundamentally wrong with my declaration but I don't know where to look.
My work computer is in an isolated room and I cannot cut and paste. Please excuse any typos that I have probably made. The code compiles and starts up, the structure is created using the pointer and populated with some data, then when I attempt to do anything with the map, the exception is thown.
I need some clues.
We need to know what a dragon is
before we study its anatomy.
(Bryan Kelly, 2010)