mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-02 11:54:27 +02:00
refactor: WeaklyRegular
moved to the end of the representation constraints
This commit is contained in:
@@ -82,11 +82,11 @@ concept ScalableWith = WeaklyRegular<T> && requires(const T v, const S s) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
concept Scalar = (!disable_scalar<T>) && WeaklyRegular<T> && requires(const T a, const T b) {
|
concept Scalar = (!disable_scalar<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>;
|
||||||
} && ScalableWith<T, T>;
|
} && ScalableWith<T, T> && WeaklyRegular<T>;
|
||||||
|
|
||||||
namespace real_impl {
|
namespace real_impl {
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ constexpr bool disable_complex = false;
|
|||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
concept Complex = (!disable_complex<T>) && WeaklyRegular<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>;
|
||||||
@@ -183,7 +183,7 @@ concept Complex = (!disable_complex<T>) && WeaklyRegular<T> && requires(const T
|
|||||||
::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>;
|
||||||
|
|
||||||
namespace magnitude_impl {
|
namespace magnitude_impl {
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ constexpr bool disable_vector = false;
|
|||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
concept Vector = (!disable_vector<T>) && WeaklyRegular<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>;
|
||||||
@@ -245,7 +245,7 @@ concept Vector = (!disable_vector<T>) && WeaklyRegular<T> && requires(const T a,
|
|||||||
// ::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>;
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user