|  |  |  | 
| Category: utilities |  | Component type: concept | 
Description
A type is EqualityComparable if objects of that type can be compared for equality using operator==, and if operator== is an equivalence relation. 
Refinement of
Associated types
Notation
| X | A type that is a model of EqualityComparable | 
| x,y,z | Object of type X | 
Definitions
Valid expressions
| Name | Expression | Type requirements | Return type | 
| Equality | x == y |  | Convertible to bool | 
| Inequality | x != y |  | Convertible to bool | 
Expression semantics
| Name | Expression | Precondition | Semantics | Postcondition | 
| Equality | x == y | xandyare in the domain of== |  |  | 
| Inequality | x != y | xandyare in the domain of== | Equivalent to !(x == y) |  | 
Complexity guarantees
Invariants
| Identity | &x == &yimpliesx==y | 
| Reflexivity | x == x | 
| Symmetry | x == yimpliesy == x | 
| Transitivity | x == yandy == zimpliesx == z | 
Models
Notes
See also
LessThanComparable.