mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-29 18:07: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>;
|
||||
|
||||
template<typename T>
|
||||
concept Scalar = (!disable_scalar<T>) && WeaklyRegular<T> && requires(T a, T b) {
|
||||
// scalar operations
|
||||
concept Scalar = (!disable_scalar<T>) && WeaklyRegular<T> && requires(T a, T b, 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>;
|
||||
{ a* b / c } -> std::common_with<T>;
|
||||
{ a / b* c } -> std::common_with<T>;
|
||||
};
|
||||
|
||||
namespace real_impl {
|
||||
|
Reference in New Issue
Block a user