diff --git a/src/include/units/physical/fps/energy.h b/src/include/units/physical/fps/energy.h index 2cef53bd..d3bdd14e 100644 --- a/src/include/units/physical/fps/energy.h +++ b/src/include/units/physical/fps/energy.h @@ -35,7 +35,7 @@ struct foot_poundal : unit {}; struct dim_energy : physical::dim_energy {}; // https://en.wikipedia.org/wiki/Foot-pound_(energy) -struct foot_pound_force : named_deduced_unit {}; +struct foot_pound_force : noble_deduced_unit {}; diff --git a/src/include/units/physical/fps/pressure.h b/src/include/units/physical/fps/pressure.h index 7fc7e5af..673843ce 100644 --- a/src/include/units/physical/fps/pressure.h +++ b/src/include/units/physical/fps/pressure.h @@ -39,7 +39,7 @@ using pressure = quantity; struct pound_force_per_foot_sq : named_scaled_unit, poundal_per_foot_sq> {}; -// struct pound_force_per_foot_sq : named_deduced_unit {}; +// struct pound_force_per_foot_sq : noble_deduced_unit {}; struct pound_force_per_inch_sq : named_scaled_unit, pound_force_per_foot_sq> {}; diff --git a/src/include/units/physical/fps/speed.h b/src/include/units/physical/fps/speed.h index d0091760..1f9badf7 100644 --- a/src/include/units/physical/fps/speed.h +++ b/src/include/units/physical/fps/speed.h @@ -37,9 +37,9 @@ using speed = quantity; struct mile_per_hour : deduced_unit{}; -struct nautical_mile_per_hour : deduced_unit{}; +struct nautical_mile_per_hour :named_deduced_derived_unit{}; -struct knot : alias_unit {}; +struct knot : alias_unit {}; inline namespace literals { diff --git a/src/include/units/unit.h b/src/include/units/unit.h index 500c2f5c..e4c06b4d 100644 --- a/src/include/units/unit.h +++ b/src/include/units/unit.h @@ -182,18 +182,36 @@ struct deduced_unit : downcast_child requires detail::same_scaled_units && (U::is_named && (URest::is_named && ... && true)) -struct named_deduced_unit : downcast_child> { +// TODO - 'noble' is placeholder to sort of mean can pass its name on to other deduced units +struct noble_deduced_unit : downcast_child> { static constexpr bool is_named = true; static constexpr auto symbol = detail::deduced_symbol_text(); using prefix_family = no_prefix; }; -// template -// struct named_deduced_derived_unit : downcast_child> { -// static constexpr bool is_named = true; -// static constexpr auto symbol = Symbol; -// using prefix_family = PF; -// }; + +/** + * @brief A named unit with a deduced ratio + * + * Defines a new unit with a deduced ratio and the given symbol based on the recipe from the provided + * derived dimension. The number and order of provided units should match the recipe of the + * derived dimension. All of the units provided should also be a named ones so it is possible + * to create a deduced symbol text. + * + * @tparam Child inherited class type used by the downcasting facility (CRTP Idiom) + * @tparam Dim a derived dimension recipe to use for deduction + * @tparam Symbol a short text representation of the unit + * @tparam PF no_prefix or a type of prefix family + * @tparam U the unit of the first composite dimension from provided derived dimension's recipe + * @tparam URest the units for the rest of dimensions from the recipe + */ +template + requires detail::same_scaled_units +struct named_deduced_derived_unit : downcast_child> { + static constexpr bool is_named = true; + static constexpr auto symbol = Symbol; + using prefix_family = PF; +}; /** * @brief An aliased named unit