I have a map<string,vector<string> > called dict mapping a string to a list of strings. I want to assign empty values to the values of certain keys. something like this:
else dict[words[i]]=<EMPTY VECTOR WHERE I CAN PUSH DATA LATER INTO>;
words is a vector of strings. How do I do this? Using the Standard template library of course.
else dict[words[i]];should be sufficient on its own. Ifdictdoes not yet contain any element with a key equivalent towords[i], a new element will be created indictwith a copy ofwords[i]as the key and with a default constructed (empty) vector as the value.If
dictalready contains an element equivalent towords[i], thendictwill not be modified.