I have a map with string key and the second atribute should be vector.
Declaration:
map <string, vector<string> > Subjects;
and then when I want to use it for adding values.
Subjects[s] = new vector<string>;
Subjects[s].push_back(n);
s and n are strings. I got error just for the first line. It says error: no match for ‘operator=’ (operand types are ‘std::map<std::basic_string<char>, std::vector<std::basic_string<char> > >::mapped_type {aka std::vector<std::basic_string<char> >}’ and ‘std::vector<std::basic_string<char> >*’) . I tried to give pointer of vector to map, but it doesn't help.
new vector<string>is redundant, the operationSubjects[s]will already construct the vector correctly - if it did not exist at keys.