forked from mpusz/mp-units
Migrate units from ratio to Magnitude
This commit is huge, but hopefully the cognitive load is not too bad. The bulk of this commit is just some fairly mechanical updates from `ratio` to `Magnitude`. Other things to call out: - `UnitRatio` goes away. We don't need this concept, because Magnitude can't even _represent_ anything that doesn't satisfy it. - I commented out some formatting test cases where the precise expression changes, but the number is completely equivalent. We will need to decide how we want to handle Magnitude formatting as a separate, follow-on task. But at least Magnitude gives us all the tools we'll need to do so!
This commit is contained in:
@@ -33,7 +33,7 @@ using namespace units;
|
||||
namespace fps {
|
||||
|
||||
struct foot : named_unit<foot, "ft", no_prefix> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", no_prefix, ratio(3), foot> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", no_prefix, as_magnitude<3>(), foot> {};
|
||||
|
||||
struct dim_length : base_dimension<"L", foot> {};
|
||||
|
||||
@@ -54,8 +54,8 @@ using length = quantity<dim_length, U, Rep>;
|
||||
|
||||
namespace fps {
|
||||
|
||||
struct foot : named_scaled_unit<foot, "ft", no_prefix, ratio(3'048, 1'000, -1), metre> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", no_prefix, ratio(3), foot> {};
|
||||
struct foot : named_scaled_unit<foot, "ft", no_prefix, as_magnitude<ratio(3'048, 1'000, -1)>(), metre> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", no_prefix, as_magnitude<3>(), foot> {};
|
||||
|
||||
struct dim_length : base_dimension<"L", foot> {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user