I am writing a parser, and I decided to save type information in a std::map. When I use the [] operator to access it, I always get the 0 value for the enum. The map is declared as such:
enum type {Bool, Bool_a, Int_4, Inta_4, Int_8, Inta_8, Float_s, Floata_s, Float_d, Floata_d, Ch_s, Ch_a, Str, Invalid};
class kparse_ret{
...
std::map<std::string, type
...
} ret_data;
And is then set using something like
ret_data.type_list[itemname] = Int_4;
(Where itemname is a std::string)
The problem I'm having is that when I use
ret_data.type_list[data_name]
I always get Bool, or 0. (again, data_name is a std::string). I know that itemname and data_name have exactly the same contents when their respective contexts are reached. Furthermore, if I use itemname again to access it, I get the value I just set it to.