diff --git a/src/systems/include/mp-units/systems/iec80000/binary_prefixes.h b/src/systems/include/mp-units/systems/iec80000/binary_prefixes.h index ca3db21e5..112e71a8f 100644 --- a/src/systems/include/mp-units/systems/iec80000/binary_prefixes.h +++ b/src/systems/include/mp-units/systems/iec80000/binary_prefixes.h @@ -27,23 +27,23 @@ namespace mp_units::iec80000 { // clang-format off -template struct kibi_ : prefixed_unit<"Ki", mag_power<2, 10>, U> {}; -template struct mebi_ : prefixed_unit<"Mi", mag_power<2, 20>, U> {}; -template struct gibi_ : prefixed_unit<"Gi", mag_power<2, 30>, U> {}; -template struct tebi_ : prefixed_unit<"Ti", mag_power<2, 40>, U> {}; -template struct pebi_ : prefixed_unit<"Pi", mag_power<2, 50>, U> {}; -template struct exbi_ : prefixed_unit<"Ei", mag_power<2, 60>, U> {}; -template struct zebi_ : prefixed_unit<"Zi", mag_power<2, 70>, U> {}; -template struct yobi_ : prefixed_unit<"Yi", mag_power<2, 80>, U> {}; +template struct kibi_ : prefixed_unit<"Ki", mag_power<2, 10>, U{}> {}; +template struct mebi_ : prefixed_unit<"Mi", mag_power<2, 20>, U{}> {}; +template struct gibi_ : prefixed_unit<"Gi", mag_power<2, 30>, U{}> {}; +template struct tebi_ : prefixed_unit<"Ti", mag_power<2, 40>, U{}> {}; +template struct pebi_ : prefixed_unit<"Pi", mag_power<2, 50>, U{}> {}; +template struct exbi_ : prefixed_unit<"Ei", mag_power<2, 60>, U{}> {}; +template struct zebi_ : prefixed_unit<"Zi", mag_power<2, 70>, U{}> {}; +template struct yobi_ : prefixed_unit<"Yi", mag_power<2, 80>, U{}> {}; -template inline constexpr kibi_ kibi; -template inline constexpr mebi_ mebi; -template inline constexpr gibi_ gibi; -template inline constexpr tebi_ tebi; -template inline constexpr pebi_ pebi; -template inline constexpr exbi_ exbi; -template inline constexpr zebi_ zebi; -template inline constexpr yobi_ yobi; +template inline constexpr kibi_> kibi; +template inline constexpr mebi_> mebi; +template inline constexpr gibi_> gibi; +template inline constexpr tebi_> tebi; +template inline constexpr pebi_> pebi; +template inline constexpr exbi_> exbi; +template inline constexpr zebi_> zebi; +template inline constexpr yobi_> yobi; // clang-format on } // namespace mp_units::iec80000 diff --git a/src/systems/include/mp-units/systems/si/prefixes.h b/src/systems/include/mp-units/systems/si/prefixes.h index f8c9431ca..09582df0d 100644 --- a/src/systems/include/mp-units/systems/si/prefixes.h +++ b/src/systems/include/mp-units/systems/si/prefixes.h @@ -27,55 +27,55 @@ namespace mp_units::si { // clang-format off -template struct quecto_ : prefixed_unit<"q", mag_power<10, -30>, U> {}; -template struct ronto_ : prefixed_unit<"r", mag_power<10, -27>, U> {}; -template struct yocto_ : prefixed_unit<"y", mag_power<10, -24>, U> {}; -template struct zepto_ : prefixed_unit<"z", mag_power<10, -21>, U> {}; -template struct atto_ : prefixed_unit<"a", mag_power<10, -18>, U> {}; -template struct femto_ : prefixed_unit<"f", mag_power<10, -15>, U> {}; -template struct pico_ : prefixed_unit<"p", mag_power<10, -12>, U> {}; -template struct nano_ : prefixed_unit<"n", mag_power<10, -9>, U> {}; -template struct micro_ : prefixed_unit, U> {}; -template struct milli_ : prefixed_unit<"m", mag_power<10, -3>, U> {}; -template struct centi_ : prefixed_unit<"c", mag_power<10, -2>, U> {}; -template struct deci_ : prefixed_unit<"d", mag_power<10, -1>, U> {}; -template struct deca_ : prefixed_unit<"da", mag_power<10, 1>, U> {}; -template struct hecto_ : prefixed_unit<"h", mag_power<10, 2>, U> {}; -template struct kilo_ : prefixed_unit<"k", mag_power<10, 3>, U> {}; -template struct mega_ : prefixed_unit<"M", mag_power<10, 6>, U> {}; -template struct giga_ : prefixed_unit<"G", mag_power<10, 9>, U> {}; -template struct tera_ : prefixed_unit<"T", mag_power<10, 12>, U> {}; -template struct peta_ : prefixed_unit<"P", mag_power<10, 15>, U> {}; -template struct exa_ : prefixed_unit<"E", mag_power<10, 18>, U> {}; -template struct zetta_ : prefixed_unit<"Z", mag_power<10, 21>, U> {}; -template struct yotta_ : prefixed_unit<"Y", mag_power<10, 24>, U> {}; -template struct ronna_ : prefixed_unit<"R", mag_power<10, 27>, U> {}; -template struct quetta_ : prefixed_unit<"Q", mag_power<10, 30>, U> {}; +template struct quecto_ : prefixed_unit<"q", mag_power<10, -30>, U{}> {}; +template struct ronto_ : prefixed_unit<"r", mag_power<10, -27>, U{}> {}; +template struct yocto_ : prefixed_unit<"y", mag_power<10, -24>, U{}> {}; +template struct zepto_ : prefixed_unit<"z", mag_power<10, -21>, U{}> {}; +template struct atto_ : prefixed_unit<"a", mag_power<10, -18>, U{}> {}; +template struct femto_ : prefixed_unit<"f", mag_power<10, -15>, U{}> {}; +template struct pico_ : prefixed_unit<"p", mag_power<10, -12>, U{}> {}; +template struct nano_ : prefixed_unit<"n", mag_power<10, -9>, U{}> {}; +template struct micro_ : prefixed_unit, U{}> {}; +template struct milli_ : prefixed_unit<"m", mag_power<10, -3>, U{}> {}; +template struct centi_ : prefixed_unit<"c", mag_power<10, -2>, U{}> {}; +template struct deci_ : prefixed_unit<"d", mag_power<10, -1>, U{}> {}; +template struct deca_ : prefixed_unit<"da", mag_power<10, 1>, U{}> {}; +template struct hecto_ : prefixed_unit<"h", mag_power<10, 2>, U{}> {}; +template struct kilo_ : prefixed_unit<"k", mag_power<10, 3>, U{}> {}; +template struct mega_ : prefixed_unit<"M", mag_power<10, 6>, U{}> {}; +template struct giga_ : prefixed_unit<"G", mag_power<10, 9>, U{}> {}; +template struct tera_ : prefixed_unit<"T", mag_power<10, 12>, U{}> {}; +template struct peta_ : prefixed_unit<"P", mag_power<10, 15>, U{}> {}; +template struct exa_ : prefixed_unit<"E", mag_power<10, 18>, U{}> {}; +template struct zetta_ : prefixed_unit<"Z", mag_power<10, 21>, U{}> {}; +template struct yotta_ : prefixed_unit<"Y", mag_power<10, 24>, U{}> {}; +template struct ronna_ : prefixed_unit<"R", mag_power<10, 27>, U{}> {}; +template struct quetta_ : prefixed_unit<"Q", mag_power<10, 30>, U{}> {}; -template inline constexpr quecto_ quecto; -template inline constexpr ronto_ ronto; -template inline constexpr yocto_ yocto; -template inline constexpr zepto_ zepto; -template inline constexpr atto_ atto; -template inline constexpr femto_ femto; -template inline constexpr pico_ pico; -template inline constexpr nano_ nano; -template inline constexpr micro_ micro; -template inline constexpr milli_ milli; -template inline constexpr centi_ centi; -template inline constexpr deci_ deci; -template inline constexpr deca_ deca; -template inline constexpr hecto_ hecto; -template inline constexpr kilo_ kilo; -template inline constexpr mega_ mega; -template inline constexpr giga_ giga; -template inline constexpr tera_ tera; -template inline constexpr peta_ peta; -template inline constexpr exa_ exa; -template inline constexpr zetta_ zetta; -template inline constexpr yotta_ yotta; -template inline constexpr ronna_ ronna; -template inline constexpr quetta_ quetta; +template inline constexpr quecto_> quecto; +template inline constexpr ronto_> ronto; +template inline constexpr yocto_> yocto; +template inline constexpr zepto_> zepto; +template inline constexpr atto_> atto; +template inline constexpr femto_> femto; +template inline constexpr pico_> pico; +template inline constexpr nano_> nano; +template inline constexpr micro_> micro; +template inline constexpr milli_> milli; +template inline constexpr centi_> centi; +template inline constexpr deci_> deci; +template inline constexpr deca_> deca; +template inline constexpr hecto_> hecto; +template inline constexpr kilo_> kilo; +template inline constexpr mega_> mega; +template inline constexpr giga_> giga; +template inline constexpr tera_> tera; +template inline constexpr peta_> peta; +template inline constexpr exa_> exa; +template inline constexpr zetta_> zetta; +template inline constexpr yotta_> yotta; +template inline constexpr ronna_> ronna; +template inline constexpr quetta_> quetta; // clang-format on } // namespace mp_units::si diff --git a/test/static/unit_test.cpp b/test/static/unit_test.cpp index d187467a0..6b3ab4d1c 100644 --- a/test/static/unit_test.cpp +++ b/test/static/unit_test.cpp @@ -212,8 +212,8 @@ static_assert(convertible(kilojoule, joule)); static_assert(kilojoule != joule); static_assert(kilojoule.symbol == "kJ"); -static_assert(is_of_type, si::kilo_>); -static_assert(is_of_type, si::kilo_>); +static_assert(is_of_type, si::kilo_>); +static_assert(is_of_type, si::kilo_>); // TODO Should the below be a scaled version of metre^2? static_assert(is_of_type>); // !!! @@ -264,7 +264,7 @@ static_assert(is_of_type); static_assert(get_canonical_unit(km_2).mag == mag<2000>); constexpr auto kJ_42 = mag<42> * si::kilo; -static_assert(is_of_type, si::kilo_>>); +static_assert(is_of_type, si::kilo_>>); static_assert( is_of_type, per>>>); static_assert(get_canonical_unit(kJ_42).mag == mag<42'000'000>); @@ -467,7 +467,7 @@ static_assert(!convertible(metre, metre* metre)); // one static_assert(is_of_type); -static_assert(is_of_type / metre, derived_unit, per>>); +static_assert(is_of_type / metre, derived_unit, per>>); static_assert(metre / metre == one); static_assert(hertz * second == one); static_assert(one * one == one); @@ -509,7 +509,7 @@ static_assert(is_of_type(metre / (second * second)), derived_unit>>); static_assert(is_of_type(kilometre), derived_unit>>); -static_assert(is_of_type(si::kilo), derived_unit, 2>>>); +static_assert(is_of_type(si::kilo), derived_unit, 2>>>); static_assert(is_of_type(hour), derived_unit>>); static_assert( is_of_type(mag<3600>* second), scaled_unit * mag<3600>, derived_unit>>>);