quantity constraints refactored

This commit is contained in:
Mateusz Pusz
2019-11-15 20:20:25 +01:00
parent 2b5eb30cd4
commit 57e464cc99
6 changed files with 241 additions and 145 deletions
+20 -2
View File
@@ -413,8 +413,26 @@ template<Unit U, Scalar Rep = double>
class quantity;
```
`units::Quantity` is a concept that is satisfied by a type that is an instantiation of `units::quantity`
class template:
where `Scalar` is the following concept:
```cpp
template<typename T, typename U = T>
concept basic-arithmetic = // exposition only
std::magma<std::ranges::plus, T, U> &&
std::magma<std::ranges::minus, T, U> &&
std::magma<std::ranges::times, T, U> &&
std::magma<std::ranges::divided_by, T, U>;
template<typename T>
concept Scalar =
(!Quantity<T>) &&
std::regular<T> &&
std::totally_ordered<T> &&
basic-arithmetic<T>;
```
`units::Quantity` is a concept that is satisfied by a type that is an instantiation of
`units::quantity` class template:
```cpp
template<typename T>