C++ greater or equal than operator

  • A+

In C++ for the operator greater or equal than (">=") is it enough to have the operators equal ("=") and greater (">") overloaded to have functionality for the greater or equal than (">=") OR do I need to overload the operator (">=") to have functionality for it?


Using an obvious notation, ">" || "==" is actually an over-requirement for ">=".

Although note that for all the relational operators, you only actually need "<", since equivalence is established if a < b and b < a are both false. In fact this is one of the concepts used in ordered C++ standard library containers.


:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: