I have to read only the first two elements from an std::map
.
Here's my code:
#include<iostream>
#include<map>
#include<iterator>
using namespace std;
int main() {
map<int,int> a;
map<int,int>:: iterator itr;
itr = a.begin();
cout<<itr->first<<" "<<itr->second<<endl;
next(itr);
cout<<itr->first<<" "<<itr->second<<endl;
return 0;
}
I'm getting this error:
next
was not declared in the scope
what am I missing here and if there is a better way to do it?