【发布时间】:2017-10-19 20:41:06
【问题描述】:
我已经安装了 CodeBloks,我正在用一个简单的问题对其进行测试。
#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>&&'
【问题讨论】:
-
这不是错误消息that you get: "error: no match for '
operator<<' (操作数类型是 'std::ostream{akastd::basic_ostream<char>}' 和 '@987654327 @'" 而且,std::pair没有这样的运算符重载。 -
读取错误消息时,从顶部开始,而不是从底部开始。特别是对于像这样的错误,其中一个错误有 很多 输出。
标签: c++ iterator unordered-map