Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between equivalence and equality?

Tags:

What is the difference between equivalence and equality in C++?

There is a very similar question here. However, this question is tagged with math, while I am interested in the meaning in C++ context.

To see the terms in context: Scott Meyers uses them in an example in this video.

like image 791
463035818_is_not_a_number Avatar asked Aug 12 '15 20:08

463035818_is_not_a_number


People also ask

Is equality an equivalence relation?

Equality is both an equivalence relation and a partial order. Equality is also the only relation on a set that is reflexive, symmetric and antisymmetric. In algebraic expressions, equal variables may be substituted for one another, a facility that is not available for equivalence related variables.

What is difference between equivalent and identical?

identical means that it only looks the same. equivalent means that they are equal.

What is equivalence and example?

In mathematics, an equivalence relation is a kind of binary relation that should be reflexive, symmetric and transitive. The well-known example of an equivalence relation is the “equal to (=)” relation.


1 Answers

On cppreference.com i found the following quote:

For the types that are both EqualityComparable and LessThanComparable, the C++ standard library makes a distinction between equality, which is the value of the expression a == b and equivalence, which is the value of the expression !(a < b) && !(b < a).

like image 113
463035818_is_not_a_number Avatar answered Sep 18 '22 17:09

463035818_is_not_a_number