http://kvance.livejournal.com/ ([identity profile] kvance.livejournal.com) wrote in [personal profile] mrlachatte 2006-06-12 01:50 am (UTC)

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.

I could, of course, be wrong.

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting