template <class T, class U>
concept bool WeaklyEqualityComparableWith =
requires(const remove_reference_t<T>& t,
const remove_reference_t<U>& u) {
{ t == u } -> Boolean&&;
{ t != u } -> Boolean&&;
{ u == t } -> Boolean&&;
{ u != t } -> Boolean&&;
};
Let t and u be const lvalues of types remove_reference_t<T> and remove_reference_t<U> respectively. WeaklyEqualityComparableWith<T, U> is satisfied only if:
t == u, u == t, t != u, and u != t have the same domain.
bool(u == t) == bool(t == u).
bool(t != u) == !bool(t == u).
bool(u != t) == bool(t != u).
template <class T>
concept bool EqualityComparable = WeaklyEqualityComparableWith<T, T>;
Let a and b be objects of type T. EqualityComparable<T> is satisfied only if:
bool(a == b) if and only if a is equal to b.
[ Note: The requirement that the expression a == b is equality preserving implies that == is reflexive, transitive, and symmetric. — end note ]
template <class T, class U>
concept bool EqualityComparableWith =
EqualityComparable<T> &&
EqualityComparable<U> &&
CommonReference<
const remove_reference_t<T>&,
const remove_reference_t<U>&> &&
EqualityComparable<
common_reference_t<
const remove_reference_t<T>&,
const remove_reference_t<U>&>> &&
WeaklyEqualityComparableWith<T, U>;