for user defined struct, as I understand, it\'s easy. Just overload the operator <. However, for int/float etc.., do I really need to overload operator < for int? Here is
You shouldn't need to overload operator <
for int
(you can't, actually). If you use an external comparator, you should be passing the same Comparator comp
to pop_head
as well.
* Edit: *
As ildjarn pointed out, your comparison operator does not implement a strict-weak-ordering relation.
a < b ? false : true; --> a >= b
b < a ? true : false; --> a > b