我想遍歷map<string, int>
中的每個元素,而不知道它的任何string-int值或鍵。C++循環映射
我到目前爲止有:
void output(map<string, int> table)
{
map<string, int>::iterator it;
for (it = table.begin(); it != table.end(); it++)
{
//How do I access each element?
}
}
[如何循環訪問C++映射](http:// stackoverflow。com/questions/4844886/how-to-loop-through-ac-map) – amanuel2 2016-04-26 01:06:04