[concept.commonref] (original) (raw)

18 Concepts library [concepts]

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 bothconvertible_to<T, C>andconvertible_to<U, C>are modeled, then T and U share acommon reference type, C.

[Note 1:

C can be the same as T or U, or can be a different type.

C can be a reference type.

— _end note_]

template<class T, class U> concept [common_reference_with](#concept:common%5Freference%5Fwith "18.4.5 Concept common_­reference_­with [concept.commonref]") = [same_as](concept.same#concept:same%5Fas "18.4.2 Concept same_­as [concept.same]")<common_reference_t<T, U>, common_reference_t<U, T>> && [convertible_to](concept.convertible#concept:convertible%5Fto "18.4.4 Concept convertible_­to [concept.convertible]")<T, common_reference_t<T, U>> && [convertible_to](concept.convertible#concept:convertible%5Fto "18.4.4 Concept convertible_­to [concept.convertible]")<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 thatdecltype((t1)) and decltype((t2)) are each T, and let u1 and u2 be equality-preserving expressions such thatdecltype((u1)) and decltype((u2)) are each U.

T and U model common_reference_with<T, U>only if

[Note 2:

Users can customize the behavior of common_reference_with by specializing the basic_common_reference class template ([meta.trans.other]).

— _end note_]