@@ -44,12 +44,7 @@ namespace mp_units {
44
44
namespace detail {
45
45
46
46
template <typename T>
47
- concept WeaklyRegular =
48
- #ifndef MP_UNITS_XCODE15_HACKS
49
- true ;
50
- #else
51
- std::copyable<T> && std::equality_comparable<T>;
52
- #endif
47
+ concept WeaklyRegular = std::copyable<T> && std::equality_comparable<T>;
53
48
54
49
template <typename T, typename S>
55
50
concept ScalableWith = requires(const T v, const S s) {
@@ -175,13 +170,18 @@ template<typename T>
175
170
concept ComplexScalar =
176
171
// TODO should the below be provided?
177
172
// (!disable_complex<T>) &&
178
- Addable<T> && ScalableWith<T, T> && requires(const T v, const T& ref) {
173
+ Addable<T> && ScalableWith<T, T> &&
174
+ requires (const T v, const T& ref) {
179
175
::mp_units::real (v);
180
176
::mp_units::imag (v);
181
177
::mp_units::modulus (v);
182
178
requires ScalableWith<T, decltype (::mp_units::modulus (v))>;
183
179
requires std::constructible_from<T, decltype (::mp_units::real (ref)), decltype (::mp_units::imag (ref))>;
184
- } && WeaklyRegular<T>;
180
+ }
181
+ #ifndef MP_UNITS_XCODE15_HACKS
182
+ && WeaklyRegular<T>
183
+ #endif
184
+ ;
185
185
186
186
} // namespace detail
187
187
@@ -197,8 +197,12 @@ MP_UNITS_INLINE constexpr bool disable_real<bool> = true;
197
197
namespace detail {
198
198
199
199
template <typename T>
200
- concept RealScalar = (!disable_real<T>) && Addable<T> && ScalableWith<T, T> && std::totally_ordered<T> &&
201
- (!ComplexScalar<T>) && WeaklyRegular<T>;
200
+ concept RealScalar =
201
+ (!disable_real<T>) && Addable<T> && ScalableWith<T, T> && std::totally_ordered<T> && (!ComplexScalar<T>)
202
+ #if MP_UNITS_COMP_GCC != 12 && !defined(MP_UNITS_XCODE15_HACKS)
203
+ && WeaklyRegular<T>
204
+ #endif
205
+ ;
202
206
203
207
template <typename T>
204
208
concept Scalar = RealScalar<T> || ComplexScalar<T>;
@@ -250,15 +254,20 @@ MP_UNITS_EXPORT inline constexpr ::mp_units::detail::magnitude_impl::magnitude_t
250
254
namespace detail {
251
255
252
256
template <typename T>
253
- concept Vector = Addable<T> && requires(const T v) {
254
- ::mp_units::magnitude (v);
255
- requires ScalableWith<T, decltype (::mp_units::magnitude (v))>;
256
- // TODO should we also check for the below (e.g., when `size() > 1` or `2`)
257
- // ::mp_units::zero_vector<T>();
258
- // ::mp_units::scalar_product(a, b);
259
- // ::mp_units::vector_product(a, b);
260
- // ::mp_units::tensor_product(a, b);
261
- } && WeaklyRegular<T>;
257
+ concept Vector = Addable<T> &&
258
+ requires (const T v) {
259
+ ::mp_units::magnitude (v);
260
+ requires ScalableWith<T, decltype (::mp_units::magnitude (v))>;
261
+ // TODO should we also check for the below (e.g., when `size() > 1` or `2`)
262
+ // ::mp_units::zero_vector<T>();
263
+ // ::mp_units::scalar_product(a, b);
264
+ // ::mp_units::vector_product(a, b);
265
+ // ::mp_units::tensor_product(a, b);
266
+ }
267
+ #ifndef MP_UNITS_XCODE15_HACKS
268
+ && WeaklyRegular<T>
269
+ #endif
270
+ ;
262
271
263
272
} // namespace detail
264
273
@@ -331,11 +340,22 @@ concept SomeRepresentation =
331
340
332
341
} // namespace detail
333
342
343
+ #ifdef MP_UNITS_XCODE15_HACKS
344
+ MP_UNITS_EXPORT template <typename T, auto V>
345
+ concept RepresentationOf =
346
+ detail::SomeRepresentation<T> &&
347
+ ((QuantitySpec<MP_UNITS_REMOVE_CONST(decltype(V))> &&
348
+ (detail::QuantityKindSpec<MP_UNITS_REMOVE_CONST(decltype(V))> || detail::IsOfCharacter<T, V.character>)) ||
349
+ (std::same_as<quantity_character, decltype(V)> && detail::IsOfCharacter<T, V>));
350
+
351
+ #else
352
+
334
353
MP_UNITS_EXPORT template <typename T, auto V>
335
354
concept RepresentationOf =
336
355
((QuantitySpec<MP_UNITS_REMOVE_CONST(decltype(V))> &&
337
356
((detail::QuantityKindSpec<MP_UNITS_REMOVE_CONST(decltype(V))> && detail::SomeRepresentation<T>) ||
338
357
detail::IsOfCharacter<T, V.character>)) ||
339
358
(std::same_as<quantity_character, decltype(V)> && detail::IsOfCharacter<T, V>));
359
+ #endif
340
360
341
361
} // namespace mp_units
0 commit comments