@@ -44,12 +44,7 @@ namespace mp_units {
4444namespace detail {
4545
4646template <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>;
5348
5449template <typename T, typename S>
5550concept ScalableWith = requires (const T v, const S s) {
@@ -175,13 +170,18 @@ template<typename T>
175170concept ComplexScalar =
176171 // TODO should the below be provided?
177172 // (!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) {
179175 ::mp_units::real (v);
180176 ::mp_units::imag (v);
181177 ::mp_units::modulus (v);
182178 requires ScalableWith<T, decltype (::mp_units::modulus (v))>;
183179 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+ ;
185185
186186} // namespace detail
187187
@@ -197,8 +197,12 @@ MP_UNITS_INLINE constexpr bool disable_real<bool> = true;
197197namespace detail {
198198
199199template <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+ ;
202206
203207template <typename T>
204208concept Scalar = RealScalar<T> || ComplexScalar<T>;
@@ -250,15 +254,20 @@ MP_UNITS_EXPORT inline constexpr ::mp_units::detail::magnitude_impl::magnitude_t
250254namespace detail {
251255
252256template <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+ ;
262271
263272} // namespace detail
264273
@@ -331,11 +340,22 @@ concept SomeRepresentation =
331340
332341} // namespace detail
333342
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+
334353MP_UNITS_EXPORT template <typename T, auto V>
335354concept RepresentationOf =
336355 ((QuantitySpec<MP_UNITS_REMOVE_CONST(decltype (V))> &&
337356 ((detail::QuantityKindSpec<MP_UNITS_REMOVE_CONST(decltype (V))> && detail::SomeRepresentation<T>) ||
338357 detail::IsOfCharacter<T, V.character>)) ||
339358 (std::same_as<quantity_character, decltype (V)> && detail::IsOfCharacter<T, V>));
359+ #endif
340360
341361} // namespace mp_units
0 commit comments