Merge branch 'master' of github.com:mpusz/units
This commit is contained in:
commit
146d7a32fb
7 files changed
+69
-41
No files matched your search
+9
-7
@@ -53,13 +53,15 @@ check_cxx_feature_supported(__cpp_explicit_this_parameter ${projectPrefix}EXPLIC
|
||||
|
||||
# libc++ has a basic supports for std::format but does not set __cpp_lib_format
|
||||
# https://github.com/llvm/llvm-project/issues/77773
|
||||
if(NOT ${projectPrefix}LIB_FORMAT_SUPPORTED
|
||||
AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang"
|
||||
AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "17"
|
||||
AND ${projectPrefix}LIBCXX
|
||||
)
|
||||
message(STATUS "Clang 17+ with libc++ detected, overriding `std::format` support")
|
||||
set(${projectPrefix}LIB_FORMAT_SUPPORTED ON)
|
||||
if(NOT ${projectPrefix}LIB_FORMAT_SUPPORTED AND ${projectPrefix}LIBCXX)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "17")
|
||||
message(STATUS "Clang 17+ with libc++ detected, overriding `std::format` support")
|
||||
set(${projectPrefix}LIB_FORMAT_SUPPORTED ON)
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "16")
|
||||
message(STATUS "AppleClang 16+ with libc++ detected, overriding `std::format` support")
|
||||
set(${projectPrefix}LIB_FORMAT_SUPPORTED ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# clang++-18 supports explicit `this` parameter
|
||||
|
||||
@@ -150,5 +150,9 @@ MP_UNITS_DIAGNOSTIC_POP
|
||||
|
||||
#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
|
||||
// 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>;
|
||||
} && ScalableWith<T, T>
|
||||
#if MP_UNITS_COMP_GCC != 12
|
||||
#if MP_UNITS_COMP_GCC != 12 && !defined(MP_UNITS_XCODE15_HACKS)
|
||||
&& WeaklyRegular<T>
|
||||
#endif
|
||||
;
|
||||
@@ -177,19 +177,23 @@ constexpr bool disable_complex = false;
|
||||
namespace detail {
|
||||
|
||||
template<typename T>
|
||||
concept Complex = (!disable_complex<T>) && requires(const T a, const T b, const T& c) {
|
||||
{ -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>;
|
||||
::mp_units::real(a);
|
||||
::mp_units::imag(a);
|
||||
::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))>;
|
||||
} && WeaklyRegular<T>;
|
||||
|
||||
concept Complex = (!disable_complex<T>) &&
|
||||
requires(const T a, const T b, const T& c) {
|
||||
{ -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>;
|
||||
::mp_units::real(a);
|
||||
::mp_units::imag(a);
|
||||
::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))>;
|
||||
}
|
||||
#ifndef MP_UNITS_XCODE15_HACKS
|
||||
&& WeaklyRegular<T>
|
||||
#endif
|
||||
;
|
||||
namespace magnitude_impl {
|
||||
|
||||
void magnitude() = delete; // poison pill
|
||||
@@ -238,19 +242,24 @@ constexpr bool disable_vector = false;
|
||||
namespace detail {
|
||||
|
||||
template<typename T>
|
||||
concept Vector = (!disable_vector<T>) && requires(const T a, const T b) {
|
||||
{ -a } -> std::common_with<T>;
|
||||
{ a + b } -> std::common_with<T>;
|
||||
{ a - b } -> std::common_with<T>;
|
||||
::mp_units::magnitude(a);
|
||||
requires ScalableWith<T, decltype(::mp_units::magnitude(a))>;
|
||||
// TODO should we also check for the below (e.g., when `size() > 1` or `2`)
|
||||
// ::mp_units::zero_vector<T>();
|
||||
// ::mp_units::unit_vector(a);
|
||||
// ::mp_units::scalar_product(a, b);
|
||||
// ::mp_units::vector_product(a, b);
|
||||
// ::mp_units::tensor_product(a, b);
|
||||
} && WeaklyRegular<T>;
|
||||
concept Vector = (!disable_vector<T>) &&
|
||||
requires(const T a, const T b) {
|
||||
{ -a } -> std::common_with<T>;
|
||||
{ a + b } -> std::common_with<T>;
|
||||
{ a - b } -> std::common_with<T>;
|
||||
::mp_units::magnitude(a);
|
||||
requires ScalableWith<T, decltype(::mp_units::magnitude(a))>;
|
||||
// TODO should we also check for the below (e.g., when `size() > 1` or `2`)
|
||||
// ::mp_units::zero_vector<T>();
|
||||
// ::mp_units::unit_vector(a);
|
||||
// ::mp_units::scalar_product(a, b);
|
||||
// ::mp_units::vector_product(a, b);
|
||||
// ::mp_units::tensor_product(a, b);
|
||||
}
|
||||
#ifndef MP_UNITS_XCODE15_HACKS
|
||||
&& WeaklyRegular<T>
|
||||
#endif
|
||||
;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
||||
Reference in new issue
Block a user