![]() |
Arene Base
Fundamental Utilities For Safety Critical C++
|
A trait which determines the common reference type for a set of types. More...
A trait which determines the common reference type for a set of types.
| Ts | The types for which to determine the common reference. |
The common reference type is defined as follows:
sizeof...(Ts) is 0, type is not defined.sizeof...(Ts) is 1, type names the only type in the pack.sizeof...(Ts) is 2, the following alternatives are considered in order:R be COMMON-REF(T0,T1). If T0 and T1 are reference types, R is well-formed, and both pointer-conversion checks to R succeed, type names R.basic_common_reference<remove_cvref_t<T0>,remove_cvref_t<T1>,T0Qual,T1Qual>::type is defined, type names that type.COND-RES(T0,T1) is well-formed, type names that type.std::common_type_t<T0,T1> is well-formed, type names that type.type is not defined.sizeof...(Ts) is greater than 2, let C be common_reference_t<T0,T1>. If C is well-formed, type names the type of common_reference<C,Ts...>; otherwise, type is not defined.The exposition-only COMMON-REF(A,B) operation is defined as follows. Let X and Y be the results of applying remove_reference_t to A and B, respectively. Let CREF(A) be a const lvalue reference to X, COPYCV(FROM,TO) be TO with the top-level cv-qualifiers of FROM, and COND-RES(X,Y) be decltype(false ? std::declval<X(&)()>()() : std::declval<Y(&)()>()()).
A and B are both lvalue reference types, COMMON-REF(A,B) is COND-RES(COPYCV(X,Y)&,COPYCV(Y,X)&) if that type exists and is a reference type.A and B are both rvalue reference types, let C be remove_reference_t<COMMON-REF(X&,Y&)>&&. If C is well-formed and both types are convertible to C, COMMON-REF(A,B) is C.A is an rvalue reference and B is an lvalue reference, let D be COMMON-REF(CREF(X),Y&). If D is well-formed and A is convertible to D, COMMON-REF(A,B) is D.A is an lvalue reference and B is an rvalue reference, COMMON-REF(A,B) is COMMON-REF(B,A).COMMON-REF(A,B) is not defined.