I have a map with a (fairly) simple key-type and a complex mapped-type, like so:
map<string, vector<string>> myMap;
If I have a vector<string>
in hand, is it possible to insert an entry into the map which copies the key but moves the mapped-value? That is, is there some way to do:
string key = "Key";
vector<string> mapped;
for (int i = 0; i < 1000; ++i)
mapped.push_back("Some dynamic string");
// Insert by moving mapped; I know I'm done with it
myMap.insert(make_pair(key, move(mapped))); // This seems to move key too