template<class T>
concept boolean-testable-impl = convertible_to<T, bool>; // exposition only
template<class T>
concept boolean-testable = // exposition only
boolean-testable-impl<T> && requires(T&& t) {
{ !std::forward<T>(t) } -> boolean-testable-impl;
};
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>>;
template<class T, class U>
concept weakly-equality-comparable-with = // exposition only
requires(const remove_reference_t<T>& t,
const remove_reference_t<U>& u) {
{ t == u } -> boolean-testable;
{ t != u } -> boolean-testable;
{ u == t } -> boolean-testable;
{ u != t } -> boolean-testable;
};
template<class T>
concept equality_comparable = weakly-equality-comparable-with<T, T>;
template<class T, class U>
concept equality_comparable_with =
equality_comparable<T> && equality_comparable<U> &&
comparison-common-type-with<T, U> &&
equality_comparable<
common_reference_t<
const remove_reference_t<T>&,
const remove_reference_t<U>&>> &&
weakly-equality-comparable-with<T, U>;
template<class T>
concept totally_ordered =
equality_comparable<T> && partially-ordered-with<T, T>;
template<class T, class U>
concept totally_ordered_with =
totally_ordered<T> && totally_ordered<U> &&
equality_comparable_with<T, U> &&
totally_ordered<
common_reference_t<
const remove_reference_t<T>&,
const remove_reference_t<U>&>> &&
partially-ordered-with<T, U>;