std::Relation

From cppreference.com
< cpplrm; | concepts
Defined in header <concepts>
template <class R, class T, class U>

concept Relation =
std::Predicate<R, T, T> &&
std::Predicate<R, U, U> &&
std::CommonReference<
const std::remove_reference_t<T>&,
const std::remove_reference_t<U>&> &&
std::Predicate<R,
std::common_reference_t<
const std::remove_reference_t<T>&,
const std::remove_reference_t<U>&>,
std::common_reference_t<
const std::remove_reference_t<T>&,
const std::remove_reference_t<U>&>> &&
std::Predicate<R, T, U> &&

std::Predicate<R, U, T>;
(1) (since C++20)

The concept Relation<R, T, U> specifies that R defines a binary relation over the set of expressions whose type and value category are those encoded by either T or U.

Given

  • r, an expression such that decltype((r)) is R,
  • t, an expression such that decltype((t)) is T,
  • u, an expression such that decltype((u)) is U,

and let C be std::common_reference_t<const std::remove_reference_t<T>&, const std::remove_reference_t<U>&>,

then Relation<R, T, U> is satisfied only if

  • bool(r(t, u)) == bool(r(C(t), C(u))) and
  • bool(r(u, t)) == bool(r(C(u), C(t))).