D
Denis Remezov
^^^^^Siemel said:Two elements a and b are equal if less(a,b) and less(b,a) are both false.
Equivalent
It is conceivable that maps and sets using a strcmp style compare function
Wait a sec. Are you sure the above is correct? Should it be
bool Person:perator '<'(const Person & p) const
{
if (this->age < p.age)
return true;
if (this->salary > p.salary)
return false;
if (this->salary < p.salary)
return true;
return false;
}
No, that wouldn't work either. Here is my take:
bool Person:perator <(Person const& rhs) const {
return age < rhs.age? true :
rhs.age < age? false :
salary < rhs.salary;
}
Denis