26namespace shamunits::prefix {
43 inline constexpr auto registry = std::to_array<NamedUnit>({
48 {
"hecto",
"hect",
hecto},
49 {
"deca",
"dec",
deca},
51 {
"centi",
"c",
centi},
52 {
"milli",
"m",
milli},
53 {
"micro",
"mu",
micro},
56 {
"femto",
"f",
femto},
A physical unit as a value: its SI dimension and its magnitude in SI base units.
constexpr Unit< T > scale(T s) noexcept
A dimensionless scale factor, e.g. a prefix: scale(1e6) (precision of the argument).
constexpr auto registry
Name registry: Python passes pref="None" by default, so "None" must stay.
constexpr Unit none
no prefix ("None", "_")
Unit from_name(std::string_view name)
Prefix from its long or short name; throws std::invalid_argument if unknown.
Name tables mapping long and short names to units, with constexpr lookup.
Unit unit_from_name(std::span< const NamedUnit > registry, std::string_view name, std::string_view kind="unit")
Unit named name in registry; throws std::invalid_argument when unknown.
constexpr bool names_are_valid(std::span< const NamedUnit > registry) noexcept
True when no name is empty and no name appears twice, long and short names together.
A unit: its dimension and its magnitude expressed in SI base units, in precision Tscal.