------- Comment #2 from pcarlini at suse dot de 2007-05-05 00:11 ------- You are only passing around a pointer to name and not allocating memory for the various "C" strings, instead overwriting each time in the loop the same char array. Well, there are also other problems in the code, like not passing to std::map as third template argument an appropriate comparison object:
struct ltstr { bool operator()(const char* s1, const char* s2) const { return std::strcmp(s1, s2) < 0; } }; I would suggest always using std::string, instead of "C" strings, at least while you are still learning std::map. -- pcarlini at suse dot de changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31825