refactor: Scalar concept refactored to give it a chance to preserve the input type for types simliar to quantity

This commit is contained in:
Mateusz Pusz
2024-12-01 14:00:52 +01:00
parent c7006f8813
commit 4831928802

View File

@ -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 {