Answer the question
In order to leave comments, you need to log in
How to change vector inside map c++?
Hello, I'm interested in solving the following problem. I have a map> and I need to access a vector by its key and resize it. How can I do it?map<string, vector<string>> SOURCE;
Answer the question
In order to leave comments, you need to log in
map<string, vector<string>> mymap;
string key = "asdf";
auto elem {mymap.find(key)};
if(elem != mymap.end())
{
//...
elem->second.resize(42);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question