vector of pairs c++ code example
Example 1: vector of pairs declaration in cpp
vector<pair<int,int>>v;
Example 2: vector of vectors of pairs c++
vector<vector<pair<int, float>>> vec(10, vector<pair<int, float>>(5, pair<int, float>(0, 0)));
for (int i = 0; i < vec.size(); i++)
{
for (int j = 0; j < vec[i].size(); j++)
{
cout << vec[i][j].first << " ";
cout << vec[i][j].second << " ";
}
cout << endl;
}