mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-30 10:27:16 +02:00
refactor: Scalar
concept refactored to give it a chance to preserve the input type for types simliar to quantity
This commit is contained in:
@ -75,13 +75,12 @@ template<typename T>
|
|||||||
concept WeaklyRegular = std::copyable<T> && std::equality_comparable<T>;
|
concept WeaklyRegular = std::copyable<T> && std::equality_comparable<T>;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
concept Scalar = (!disable_scalar<T>) && WeaklyRegular<T> && requires(T a, T b) {
|
concept Scalar = (!disable_scalar<T>) && WeaklyRegular<T> && requires(T a, T b, T c) {
|
||||||
// scalar operations
|
|
||||||
{ -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>;
|
||||||
{ a* b } -> std::common_with<T>;
|
{ a* b / c } -> std::common_with<T>;
|
||||||
{ a / b } -> std::common_with<T>;
|
{ a / b* c } -> std::common_with<T>;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace real_impl {
|
namespace real_impl {
|
||||||
|
Reference in New Issue
Block a user