等价和平等有什么区别?
What is the difference between equivalence and equality?
C++ 中的等价和相等有什么区别?
有一个非常相似的问题here. However, this question is tagged with math,而我对 C++ 上下文中的含义感兴趣。
要在上下文中查看术语:Scott Meyers 在此 video 的示例中使用了它们。
我在 cppreference.com 上找到了以下引述:
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).
C++ 中的等价和相等有什么区别?
有一个非常相似的问题here. However, this question is tagged with math,而我对 C++ 上下文中的含义感兴趣。
要在上下文中查看术语:Scott Meyers 在此 video 的示例中使用了它们。
我在 cppreference.com 上找到了以下引述:
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).