bool comp(const pair<int, int>& a, const pair<int,int>& b){
if (v[a.first]>v[b.first]) {
return true;
}
else if(v[a.first] == v[b.first] && a.second < b.second){
return true;
}
return false;
}
So, I was going through a code and I came across this comparator function for sorting a vector of pairs. Now, I am fairly new to C++. I tried reading on other questions as to how does this comparator work? But I am not able to understand. Why is the return type bool? And what does returning the value true means?