我在map
迭代器中没有匹配的运算符。当我尝试创建迭代器时,它指向map end-1。
#include <iostream>
#include <map>
int main()
{
std::map<char,int> mymap;
mymap['b'] = 100;
mymap['a'] = 200;
mymap['c'] = 300;
// show content:
for (std::map<char,int>::iterator it=mymap.begin(); it!=mymap.end()-1; ++it){
std::cout << it->first << " => " << it->second << '\n';
}
return 0;
}
https://stackoverflow.com/questions/52544364
复制相似问题