Here's a theory off the top of my head: std::map doesn't do anything special for the char* data type, which you want to use as a string. You're really just mapping a pointer to an int.
The string "test" in State::State() is in a different memory location than the string "test" in GUI::GUI(). Since that pointer isn't in the map, you get the zero return value. If you had used a std::string as the key type, the strings' VALUES would have been compared and your int would have been found.
no subject
Date: 2006-06-12 01:50 am (UTC)The string "test" in State::State() is in a different memory location than the string "test" in GUI::GUI(). Since that pointer isn't in the map, you get the zero return value. If you had used a std::string as the key type, the strings' VALUES would have been compared and your int would have been found.
I could, of course, be wrong.