12template<
typename T,
typename U>
16 template<
typename T,
typename U>
19 template<
typename T,
typename U>
22 template<
typename T,
typename U>
25 template<
typename T,
typename U>
26 concept ReferenceCommonType =
requires {
30 template<
typename... Types>
31 struct CommonTypeHelper {};
34 struct CommonTypeHelper<T> : CommonTypeHelper<T, T> {};
36 template<
typename T,
typename U>
37 requires(NeedsDecay<T, U>)
38 struct CommonTypeHelper<T, U> : CommonTypeHelper<meta::
Decay<T>, meta::
Decay<U>> {};
40 template<
typename T,
typename U>
41 requires(!NeedsDecay<T, U> && HasCustomCommonType<T, U>)
42 struct CommonTypeHelper<T, U> : TypeConstant<typename CustomCommonType<T, U>::Type> {};
44 template<
typename T,
typename U>
45 requires(!NeedsDecay<T, U> && !HasCustomCommonType<T, U> && ValueCommonType<T, U>)
46 struct CommonTypeHelper<T, U>
49 template<
typename T,
typename U>
50 requires(!NeedsDecay<T, U> && !HasCustomCommonType<T, U> && !ValueCommonType<T, U> && ReferenceCommonType<T, U>)
51 struct CommonTypeHelper<T, U>
52 : TypeConstant<meta::Decay<decltype(false ? util::declval<meta::RemoveReference<T> const&>()
53 : util::declval<meta::RemoveReference<U> const&>())>> {};
55 template<
typename T,
typename U,
typename W,
typename... Rest>
56 requires(
requires {
typename CommonTypeHelper<T, U>::Type; })
57 struct CommonTypeHelper<T, U, W, Rest...> : CommonTypeHelper<typename CommonTypeHelper<T, U>::Type, W, Rest...> {};
60template<
typename... Types>
61requires(
requires {
typename detail::CommonTypeHelper<Types...>
::Type; })
64template<
typename T,
typename U,
template<
typename>
typename TQual,
template<
typename>
typename UQual>
69 auto __get_value() -> T;
72 struct ProjectQualifiers {
77 template<
typename T,
typename U,
typename R>
78 struct UnionCV : TypeConstant<R> {};
80 template<
typename T,
typename U,
typename R>
81 struct UnionCV<T const, U, R> : TypeConstant<R const> {};
83 template<
typename T,
typename U,
typename R>
84 struct UnionCV<T const, U const, R> : TypeConstant<R const> {};
86 template<
typename T,
typename U,
typename R>
87 struct UnionCV<T const, U volatile, R> : TypeConstant<R const volatile> {};
89 template<
typename T,
typename U,
typename R>
90 struct UnionCV<T const, U const volatile, R> : TypeConstant<R const volatile> {};
92 template<
typename T,
typename U,
typename R>
93 struct UnionCV<T volatile, U, R> : TypeConstant<R volatile> {};
95 template<
typename T,
typename U,
typename R>
96 struct UnionCV<T volatile, U const, R> : TypeConstant<R const volatile> {};
98 template<
typename T,
typename U,
typename R>
99 struct UnionCV<T volatile, U volatile, R> : TypeConstant<R volatile> {};
101 template<
typename T,
typename U,
typename R>
102 struct UnionCV<T volatile, U const volatile, R> : TypeConstant<R const volatile> {};
104 template<
typename T,
typename U,
typename R>
105 struct UnionCV<T const volatile, U, R> : TypeConstant<R const volatile> {};
107 template<
typename T,
typename U,
typename R>
108 struct UnionCV<T const volatile, U const, R> : TypeConstant<R const volatile> {};
110 template<
typename T,
typename U,
typename R>
111 struct UnionCV<T const volatile, U volatile, R> : TypeConstant<R const volatile> {};
113 template<
typename T,
typename U,
typename R>
114 struct UnionCV<T const volatile, U const volatile, R> : TypeConstant<R const volatile> {};
116 template<
typename T,
typename U>
117 struct SimpleCommonReference {};
119 template<concepts::LValueReference T, concepts::LValueReference U>
126 struct SimpleCommonReference<T, U>
127 : TypeConstant<decltype(false
133 template<concepts::RValueReference T, concepts::RValueReference U>
134 requires(
requires {
typename SimpleCommonReference<T&, U&>::Type; } &&
135 concepts::ImplicitlyConvertibleTo<T, typename SimpleCommonReference<T&, U&>::Type> &&
136 concepts::ImplicitlyConvertibleTo<U, typename SimpleCommonReference<T&, U&>::Type>)
137 struct SimpleCommonReference<T, U> : TypeConstant<typename SimpleCommonReference<T&, U&>::Type> {};
139 template<concepts::LValueReference T, concepts::RValueReference U>
141 typename SimpleCommonReference<T, meta::RemoveReference<U>
const&>
::Type;
142 } && concepts::ImplicitlyConvertibleTo<U &&,
143 typename SimpleCommonReference<T, meta::RemoveReference<U>
const&>
::Type>)
144 struct SimpleCommonReference<T, U>
145 : TypeConstant<typename SimpleCommonReference<T, meta::RemoveReference<U> const&>::Type> {};
147 template<concepts::RValueReference T, concepts::LValueReference U>
148 struct SimpleCommonReference<T, U> : SimpleCommonReference<U, T> {};
150 template<
typename T,
typename U>
151 concept HasSimpleCommonReference =
requires {
typename SimpleCommonReference<T, U>::Type; };
153 template<
typename T,
typename U>
154 concept HasCustomCommonReference =
requires {
155 typename CustomCommonReference<T, U, ProjectQualifiers<T>::template Type,
156 ProjectQualifiers<U>::template Type>
::Type;
159 template<
typename T,
typename U>
160 concept HasValueCommonReference =
requires {
false ? __get_value<T>() : __get_value<U>(); };
162 template<
typename T,
typename U>
163 concept HasCommonTypeCommonReference =
requires {
typename CommonType<T, U>; };
165 template<
typename... Types>
166 struct CommonReferenceHelper {};
169 struct CommonReferenceHelper<T> : TypeConstant<T> {};
171 template<
typename T,
typename U>
172 requires(HasSimpleCommonReference<T, U>)
173 struct CommonReferenceHelper<T, U> : TypeConstant<typename SimpleCommonReference<T, U>::Type> {};
175 template<
typename T,
typename U>
176 requires(!HasSimpleCommonReference<T, U> && HasCustomCommonReference<T, U>)
177 struct CommonReferenceHelper<T, U>
178 : TypeConstant<typename CustomCommonReference<T, U, ProjectQualifiers<T>::template Type,
179 ProjectQualifiers<U>::template Type>::Type> {};
181 template<
typename T,
typename U>
182 requires(!HasSimpleCommonReference<T, U> && !HasCustomCommonReference<T, U> && HasValueCommonReference<T, U>)
183 struct CommonReferenceHelper<T, U> : TypeConstant<decltype(false ? __get_value<T>() : __get_value<U>())> {};
185 template<
typename T,
typename U>
186 requires(!HasSimpleCommonReference<T, U> && !HasCustomCommonReference<T, U> && !HasValueCommonReference<T, U> &&
187 HasCommonTypeCommonReference<T, U>)
188 struct CommonReferenceHelper<T, U> : TypeConstant<CommonType<T, U>> {};
190 template<
typename T,
typename U,
typename W,
typename... Rest>
191 requires(
requires {
typename CommonReferenceHelper<T, U>::Type; })
192 struct CommonReferenceHelper<T, U, W, Rest...>
193 : CommonReferenceHelper<typename CommonReferenceHelper<T, U>::Type, W, Rest...> {};
196template<
typename... Types>
197requires(
requires {
typename detail::CommonReferenceHelper<Types...>
::Type; })
202template<
typename T,
typename U>
207template<
typename T,
typename U>
Definition operations.h:99
Definition any_storable.h:9
auto declval() -> meta::AddRValueReference< T >
Definition declval.h:8
auto declval() -> meta::AddRValueReference< T >
Definition declval.h:8