so right now I have the following code:
map<string, vector<vector<string>>> my_map;
vector<string> vec1 = {"Adam", "Kevin", "Sam"};
vector<string> vec2 = {"Apple", "Banana", "Pear"};
vector<string> vec3 = {"Cat", "Dog", "Mouse"};
my_map["Adam"].push_back(vec1);
my_map["Apple"].push_back(vec2);
my_map["Cat"].push_back(vec3);
I have the initialized map, my_map, and I want to print out all of the contents of its vectors in order. I currently have the following code:
for (auto it = my_map.begin(); it < my_map.end(); it++) {
cout << it.first << " " << it.second[2] << '\n';
}
These lines (specifically the cout) do not compile, and I don't know why. Sublime is telling me "no member named first/second". It should print Sam Pear Mouse
Does anyone know what I'm doing wrong and how to fix this? Thanks