In my program, I have a map with string keys and a list (of a user-defined class) with values defined like this:
std::map<const char*, std::list<Show>> _shows;
I have a function that adds to a specific list, for example:
void Add(Show s, const char* index) {
list<Show> lshow = _shows[index];
lshow.push_back(s); }
However, every time a function is called with the same index, instead of returning the same list, I get an empty list.
What am I doing wrong?
ETA: I see that the number of values in the dictionary increases after each function call. Could this be the [] operator associated?
source
share