I can define a compare class for a map like this:
struct classcomp {
bool operator() (const string& lhs, const string& rhs) const
{
if(lhs < rhs)
return true;
else
return false;
}
};
but here lhs
and rhs
represent keys. What if I want to compare by values instead of key?
How will I do that?