#include <iostream>
#include<vector>
#include<map>
using namespace std;
int main() {
vector<int> v1{1,2,3,4,5};
auto it1 = v1.begin();
auto it2 = v1.end();
if(it1<it2){
cout<<"TRUE"<<endl; // Output: TRUE
}
map<int,int> m;
m.insert(make_pair(1,2));
m.insert(make_pair(5,7));
auto it3 = m.begin();
auto it4 = m.end();
if(it3<it4){
cout<<"TRUE"<<endl;
}
/*
error: no match for 'operator<' (operand types are 'std::_Rb_tree_iterator<std::pair<const int, int> >' and 'std::_Rb_tree_iterator<std::pair<const int, int> >')
18 | if(it3<it4){
| ~~~^~~~
*/
}
Line (it1<it2) works fine when using vector but (it3<it4) does not work when using map? Please explain this concept.