What is the difference between equivalence and equality?

限于喜欢 提交于 2019-12-09 05:06:56

问题


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.


回答1:


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).



来源:https://stackoverflow.com/questions/31974941/what-is-the-difference-between-equivalence-and-equality

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!