18 Concepts library [concepts]

18.5 Comparison concepts [concepts.compare]

18.5.3 Comparison common types [concept.comparisoncommontype]

template<class T, class U, class C = common_reference_t<const T&, const U&>> concept comparison-common-type-with-impl = // exposition only same_­as<common_reference_t<const T&, const U&>, common_reference_t<const U&, const T&>> && requires { requires convertible_­to<const T&, const C&> || convertible_­to<T, const C&>; requires convertible_­to<const U&, const C&> || convertible_­to<U, const C&>; }; template<class T, class U> concept comparison-common-type-with = // exposition only comparison-common-type-with-impl<remove_cvref_t<T>, remove_cvref_t<U>>;
Let C be common_­reference_­t<const T&, const U&>.
Let t1 and t2 be equality-preserving expressions that are lvalues of type remove_­cvref_­t<T>, and let u1 and u2 be equality-preserving expressions that are lvalues of type remove_­cvref_­t<U>.
T and U model comparison-common-type-with<T, U> only if:
  • CONVERT_­TO_­LVALUE<C>(t1) equals CONVERT_­TO_­LVALUE<C>(t2) if and only if t1 equals t2, and
  • CONVERT_­TO_­LVALUE<C>(u1) equals CONVERT_­TO_­LVALUE<C>(u2) if and only if u1 equals u2