Is there a way to do this initialization of my vector of unordered maps in one line?
vector<unordered_map<int,int>> lookup;
for (int i = 0; i < vector_size; i++)
{
unordered_map<int, int> map;
lookup.push_back(map);
}
Is there a way to do this initialization of my vector of unordered maps in one line?
vector<unordered_map<int,int>> lookup;
for (int i = 0; i < vector_size; i++)
{
unordered_map<int, int> map;
lookup.push_back(map);
}
vector<unordered_map<int, int>> lookup(vector_size);
Syntax - vector<container or data_type> vector_name(size, initial_value)