虽然我使用像这样的迭代器,
//include header files
using namespace std;
int main()
{
map<int,int> intIntMap;
map<int,int>::iterator pos;
pos = intIntMap.begin();
intIntMap[0] = 1;
intIntMap[3] = 5;
intIntMap[4] = 9;
intIntMap[5] = 5;
//??
cout << (*pos).first << endl;
while( pos != intIntMap.end() )
{
cout << pos->first << " <---> " << pos->second << endl;
pos++;
}
}
Run Code Online (Sandbox Code Playgroud)
输出为4;
但是我使用像这样的迭代器:
//include header file
using namespace std;
int main()
{
map<int,int> intIntMap;
map<int,int>::iterator pos;
intIntMap[0] = 1;
intIntMap[3] = 5;
intIntMap[4] = 9;
intIntMap[5] …Run Code Online (Sandbox Code Playgroud)