mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-31 10:57:16 +02:00
Merge pull request #655 from rothmichaels/bugfix/apple-clang-crash
Fixes for apple-clang crashes and performance issues
This commit is contained in:
@ -150,5 +150,9 @@ MP_UNITS_DIAGNOSTIC_POP
|
|||||||
|
|
||||||
#define MP_UNITS_API_NO_CRTP 1
|
#define MP_UNITS_API_NO_CRTP 1
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__clang__) && defined(__apple_build_version__) && __apple_build_version__ < 16000026
|
||||||
|
#define MP_UNITS_XCODE15_HACKS
|
||||||
#endif
|
#endif
|
||||||
// NOLINTEND(bugprone-reserved-identifier, cppcoreguidelines-macro-usage)
|
// NOLINTEND(bugprone-reserved-identifier, cppcoreguidelines-macro-usage)
|
||||||
|
@ -88,7 +88,7 @@ concept Scalar = (!disable_scalar<T>) &&
|
|||||||
{ a + b } -> std::common_with<T>;
|
{ a + b } -> std::common_with<T>;
|
||||||
{ a - b } -> std::common_with<T>;
|
{ a - b } -> std::common_with<T>;
|
||||||
} && ScalableWith<T, T>
|
} && ScalableWith<T, T>
|
||||||
#if MP_UNITS_COMP_GCC != 12
|
#if MP_UNITS_COMP_GCC != 12 && !defined(MP_UNITS_XCODE15_HACKS)
|
||||||
&& WeaklyRegular<T>
|
&& WeaklyRegular<T>
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
@ -177,7 +177,8 @@ constexpr bool disable_complex = false;
|
|||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
concept Complex = (!disable_complex<T>) && requires(const T a, const T b, const T& c) {
|
concept Complex = (!disable_complex<T>) &&
|
||||||
|
requires(const T a, const T b, const T& c) {
|
||||||
{ -a } -> std::common_with<T>;
|
{ -a } -> std::common_with<T>;
|
||||||
{ a + b } -> std::common_with<T>;
|
{ a + b } -> std::common_with<T>;
|
||||||
{ a - b } -> std::common_with<T>;
|
{ a - b } -> std::common_with<T>;
|
||||||
@ -188,8 +189,11 @@ concept Complex = (!disable_complex<T>) && requires(const T a, const T b, const
|
|||||||
::mp_units::modulus(a);
|
::mp_units::modulus(a);
|
||||||
requires ScalableWith<T, decltype(::mp_units::modulus(a))>;
|
requires ScalableWith<T, decltype(::mp_units::modulus(a))>;
|
||||||
requires std::constructible_from<T, decltype(::mp_units::real(c)), decltype(::mp_units::imag(c))>;
|
requires std::constructible_from<T, decltype(::mp_units::real(c)), decltype(::mp_units::imag(c))>;
|
||||||
} && WeaklyRegular<T>;
|
}
|
||||||
|
#ifndef MP_UNITS_XCODE15_HACKS
|
||||||
|
&& WeaklyRegular<T>
|
||||||
|
#endif
|
||||||
|
;
|
||||||
namespace magnitude_impl {
|
namespace magnitude_impl {
|
||||||
|
|
||||||
void magnitude() = delete; // poison pill
|
void magnitude() = delete; // poison pill
|
||||||
@ -238,7 +242,8 @@ constexpr bool disable_vector = false;
|
|||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
concept Vector = (!disable_vector<T>) && requires(const T a, const T b) {
|
concept Vector = (!disable_vector<T>) &&
|
||||||
|
requires(const T a, const T b) {
|
||||||
{ -a } -> std::common_with<T>;
|
{ -a } -> std::common_with<T>;
|
||||||
{ a + b } -> std::common_with<T>;
|
{ a + b } -> std::common_with<T>;
|
||||||
{ a - b } -> std::common_with<T>;
|
{ a - b } -> std::common_with<T>;
|
||||||
@ -250,7 +255,11 @@ concept Vector = (!disable_vector<T>) && requires(const T a, const T b) {
|
|||||||
// ::mp_units::scalar_product(a, b);
|
// ::mp_units::scalar_product(a, b);
|
||||||
// ::mp_units::vector_product(a, b);
|
// ::mp_units::vector_product(a, b);
|
||||||
// ::mp_units::tensor_product(a, b);
|
// ::mp_units::tensor_product(a, b);
|
||||||
} && WeaklyRegular<T>;
|
}
|
||||||
|
#ifndef MP_UNITS_XCODE15_HACKS
|
||||||
|
&& WeaklyRegular<T>
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user