This is because comparison operators require the type EqualityComparable or LessThanComparable .
Only == and < you can get equivalent != , <= , >= And > . In other words, only using 2 operators can you get all 6 comparisons (assuming I was not mistaken in the logic):
(a != b) is !(a == b) (a <= b) is !(b < a) (a >= b) is !(a < b) (a > b) is (b < a)
Standard containers use this normally and will use operator== and operator< when performing type comparisons.
So yes, that is how it should be.
Regarding the second part of the question (why), I'm actually not quite sure why other operators are not used, if available.
source share