forked from mpusz/mp-units
Design cleanup
- unknown_unit added - examples refactored - base_type renamed to downcast_base_type - scaled_unit renamed to named_scaled_unit - detail::reference_unit renamed to scaled_unit - quantity_test cleanup
This commit is contained in:
@@ -30,23 +30,23 @@ using namespace units;
|
||||
struct metre : named_unit<metre, "m", si::prefix> {};
|
||||
struct centimetre : prefixed_unit<centimetre, si::centi, metre> {};
|
||||
struct kilometre : prefixed_unit<kilometre, si::kilo, metre> {};
|
||||
struct yard : scaled_unit<yard, "yd", no_prefix, ratio<9'144, 10'000>, metre> {};
|
||||
struct foot : scaled_unit<foot, "ft", no_prefix, ratio<1, 3>, yard> {};
|
||||
struct yard : named_scaled_unit<yard, "yd", no_prefix, ratio<9'144, 10'000>, metre> {};
|
||||
struct foot : named_scaled_unit<foot, "ft", no_prefix, ratio<1, 3>, yard> {};
|
||||
struct dim_length : base_dimension<"length", metre> {};
|
||||
|
||||
struct second : named_unit<second, "s", si::prefix> {};
|
||||
struct hour : scaled_unit<hour, "h", no_prefix, ratio<3600>, second> {};
|
||||
struct hour : named_scaled_unit<hour, "h", no_prefix, ratio<3600>, second> {};
|
||||
struct dim_time : base_dimension<"time", second> {};
|
||||
|
||||
struct metre_per_second : unit<metre_per_second> {};
|
||||
struct dim_velocity : derived_dimension<dim_velocity, metre_per_second, exp<dim_length, 1>, exp<dim_time, -1>> {};
|
||||
struct kilometre_per_hour : deduced_unit<kilometre_per_hour, dim_velocity, kilometre, hour> {};
|
||||
|
||||
static_assert(std::is_same_v<downcast<detail::reference_unit<metre, ratio<1>>>, metre>);
|
||||
static_assert(std::is_same_v<downcast<detail::reference_unit<metre, ratio<1, 100>>>, centimetre>);
|
||||
static_assert(std::is_same_v<downcast<detail::reference_unit<metre, ratio<yard::ratio::num, yard::ratio::den>>>, yard>);
|
||||
static_assert(std::is_same_v<downcast<detail::reference_unit<metre, ratio_multiply<typename yard::ratio, ratio<1, 3>>>>, foot>);
|
||||
static_assert(std::is_same_v<downcast<detail::reference_unit<metre_per_second, ratio_divide<typename kilometre::ratio, typename hour::ratio>>>, kilometre_per_hour>);
|
||||
static_assert(std::is_same_v<downcast<scaled_unit<metre, ratio<1>>>, metre>);
|
||||
static_assert(std::is_same_v<downcast<scaled_unit<metre, ratio<1, 100>>>, centimetre>);
|
||||
static_assert(std::is_same_v<downcast<scaled_unit<metre, ratio<yard::ratio::num, yard::ratio::den>>>, yard>);
|
||||
static_assert(std::is_same_v<downcast<scaled_unit<metre, ratio_multiply<typename yard::ratio, ratio<1, 3>>>>, foot>);
|
||||
static_assert(std::is_same_v<downcast<scaled_unit<metre_per_second, ratio_divide<typename kilometre::ratio, typename hour::ratio>>>, kilometre_per_hour>);
|
||||
|
||||
static_assert(centimetre::symbol == "cm");
|
||||
static_assert(kilometre::symbol == "km");
|
||||
|
||||
Reference in New Issue
Block a user