forked from mpusz/mp-units
refactor: 💥 basic_concepts, quantity and quantity_cast refactored
BREAKING CHANGE: ScalableNumber renamed to QuantityValue Resolves #107
This commit is contained in:
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user