How to iterate through a std::map<string,int> and std::vector<int> using single for loop?
How to iterate through a std::map<string,int> and std::vector<int> using single for loop ? I have seen this questions but could not solve my problem. I am trying like this map<string,int> data; data["Shravan"] = 1; data["Mama"] = 2; data["Sa1"] = 3; data["Jhandu"] = 4; vector<int> values = {1,2,3,4}; for(const auto& it1: data,it2 : values) { // Do something } Edit : I can not go through one by one. Because i am using the key of std::map and value of std::vector in the same function. Which will be called inside for loop. Both the container of same size. If you know there's both the same length,