Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A13-5-4 opposite operator clarification
#1
We would like to get clarification on what "opposite operators" means.

The referenced JSF guideline says (such as == and !=) which implies there are others, but there are no examples present other than "!= and ==". 

Presumably this includes relational operators, but it doesn't discuss how. This rule would seemingly imply that <= should be implemented using >=. But would this mean that it is considered non-compliant to implement it with operator >?


Code:
inline bool operator<=(const X& lhs, const X& rhs) { return !(lhs > rhs); }

Are relational operators allowed to call any other relational operators? Are there any other pairings that are considered opposites for this rule?
Reply


Messages In This Thread
A13-5-4 opposite operator clarification - by aromauld - 26-04-2024, 03:34 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)