C++遍历map方法 C++中访问容器需要使用迭代器,而非下标。 c++98 map<string, int>::iterator it; for (it = m2.begin(); it != m2.end(