refactor: 💥 basic_concepts, quantity and quantity_cast refactored

BREAKING CHANGE:  ScalableNumber renamed to QuantityValue

Resolves #107
This commit is contained in:
Mateusz Pusz
2020-10-06 18:17:52 +02:00
parent 40f205b381
commit cfc90f4aac
96 changed files with 1620 additions and 1017 deletions
+2 -2
View File
@@ -18,7 +18,7 @@ For example the speed of light constant in :term:`SI` is defined as::
namespace si::si2019 {
template<ScalableNumber Rep = double>
template<QuantityValue Rep = double>
inline constexpr auto speed_of_light = speed<metre_per_second, Rep>(299792458);
}
@@ -27,7 +27,7 @@ The same constant defined for natural units may be provided as::
namespace natural {
template<ScalableNumber Rep = double>
template<QuantityValue Rep = double>
inline constexpr auto speed_of_light = speed<one, Rep>(1);
}
+2 -2
View File
@@ -58,8 +58,8 @@ dimension, than we will end up with just a scalable number type:
Time auto dur1 = 10_q_s;
Time auto dur2 = 2_q_s;
Frequency auto fr1 = 5_q_Hz;
ScalableNumber auto v1 = dur1 / dur2; // 5
ScalableNumber auto v2 = dur1 * fr1; // 50
QuantityValue auto v1 = dur1 / dur2; // 5
QuantityValue auto v2 = dur1 * fr1; // 50
Quantity points have a more restricted set of operations.
Quantity points can't be added together,
+3 -3
View File
@@ -34,7 +34,7 @@ type to ``double`` by default::
namespace si {
template<Unit U, ScalableNumber Rep = double>
template<Unit U, QuantityValue Rep = double>
using length = quantity<dim_length, U, Rep>;
}
@@ -75,7 +75,7 @@ be used::
All instances of `quantity` class always match the `Quantity` concept.
All other regular types that are not quantities are called
:term:`scalable numbers <scalable number>` by the library and match the
`ScalableNumber` concept.
`QuantityValue` concept.
However, the above is not the most important usage of those concepts. Let's
assume that the user wants to implement an ``avg_speed`` function that will
@@ -185,7 +185,7 @@ are provided::
template<typename T>
concept Dimensionless = QuantityOf<T, dim_one>;
template<Unit U, ScalableNumber Rep = double>
template<Unit U, QuantityValue Rep = double>
using dimensionless = quantity<dim_one, U, Rep>;
There are two special units provided for usage with such a quantity: