我已经安装了CodeBloks,并且正在用一个简单的问题对它进行测试。无法打印指向unordered_map元素的指针
#include <iostream>
#include <unordered_map>
using namespace std;
int main()
{
unordered_map<int,int> mp;
mp[1]=2;
mp[2]=3;
for(unordered_map<int,int>::iterator it = mp.begin();it!=mp.end();it++)
cout<<*it<<" ";
return 0;
}
我得到这个错误:
cannot bind 'std::ostream {aka std::basic_ostream<char>}' lvalue to 'std::basic_ostream<char>&&'
这不是错误消息[你得到(https://ideone.com/Fc4Dc1): “_error:'operator <<''不匹配(操作数类型是'std :: ostream' {aka'std :: basic_ostream'}'和''std :: pair '' _“而且,std :: pair没有这样的操作符重载 –
当读取错误信息时,从顶部开始,而不是从底部开始,特别是对于这样的错误,其中有一个错误输出很多* – Kevin