18 Concepts library [concepts]

18.4 Language-related concepts [concepts.lang]

18.4.5 Concept common_­reference_­with [concept.commonref]

For two types T and U, if common_­reference_­t<T, U> is well-formed and denotes a type C such that both convertible_­to<T, C> and convertible_­to<U, C> are modeled, then T and U share a common reference type, C.
[Note 1:
C could be the same as T, or U, or it could be a different type.
C can be a reference type.
— end note]
template<class T, class U> concept common_­reference_­with = same_­as<common_reference_t<T, U>, common_reference_t<U, T>> && convertible_­to<T, common_reference_t<T, U>> && convertible_­to<U, common_reference_t<T, U>>;
Let C be common_­reference_­t<T, U>.
Let t1 and t2 be equality-preserving expressions ([concepts.equality]) such that decltype((t1)) and decltype((t2)) are each T, and let u1 and u2 be equality-preserving expressions such that decltype((u1)) and decltype((u2)) are each U.
T and U model common_­reference_­with<T, U> only if:
  • C(t1) equals C(t2) if and only if t1 equals t2, and
  • C(u1) equals C(u2) if and only if u1 equals u2.
[Note 2:
Users can customize the behavior of common_­reference_­with by specializing the basic_­common_­reference class template ([meta.trans.other]).
— end note]