diff --git a/src/include/units/frequency.h b/src/include/units/frequency.h index aa6efce0..f5b8b528 100644 --- a/src/include/units/frequency.h +++ b/src/include/units/frequency.h @@ -36,22 +36,22 @@ namespace units { template using frequency = quantity; - struct millihertz : unit {}; - template<> struct upcasting_traits> : upcast_to {}; - struct hertz : derived_unit {}; template<> struct upcasting_traits> : upcast_to {}; - struct kilohertz : unit {}; + struct millihertz : milli {}; + template<> struct upcasting_traits> : upcast_to {}; + + struct kilohertz : kilo {}; template<> struct upcasting_traits> : upcast_to {}; - struct megahertz : unit {}; + struct megahertz : mega {}; template<> struct upcasting_traits> : upcast_to {}; - struct gigahertz : unit {}; + struct gigahertz : giga {}; template<> struct upcasting_traits> : upcast_to {}; - struct terahertz : unit {}; + struct terahertz : tera {}; template<> struct upcasting_traits> : upcast_to {}; inline namespace literals { diff --git a/src/include/units/length.h b/src/include/units/length.h index be662b5c..4bdfb04c 100644 --- a/src/include/units/length.h +++ b/src/include/units/length.h @@ -37,16 +37,16 @@ namespace units { using length = quantity; // SI units - struct millimeter : unit {}; - template<> struct upcasting_traits> : upcast_to {}; - - struct centimeter : unit> {}; - template<> struct upcasting_traits> : upcast_to {}; - struct meter : unit> {}; template<> struct upcasting_traits> : upcast_to {}; - struct kilometer : unit {}; + struct millimeter : milli {}; + template<> struct upcasting_traits> : upcast_to {}; + + struct centimeter : centi {}; + template<> struct upcasting_traits> : upcast_to {}; + + struct kilometer : kilo {}; template<> struct upcasting_traits> : upcast_to {}; inline namespace literals { diff --git a/src/include/units/mass.h b/src/include/units/mass.h index d0672020..a7ed4c01 100644 --- a/src/include/units/mass.h +++ b/src/include/units/mass.h @@ -39,11 +39,15 @@ namespace units { struct gram : unit {}; template<> struct upcasting_traits> : upcast_to {}; - struct kilogram : unit> {}; + struct kilogram : kilo {}; template<> struct upcasting_traits> : upcast_to {}; inline namespace literals { + // g + constexpr auto operator""_g(unsigned long long l) { return mass(l); } + constexpr auto operator""_g(long double l) { return mass(l); } + // kg constexpr auto operator""_kg(unsigned long long l) { return mass(l); } constexpr auto operator""_kg(long double l) { return mass(l); } diff --git a/src/include/units/time.h b/src/include/units/time.h index 3602fa06..eff1399b 100644 --- a/src/include/units/time.h +++ b/src/include/units/time.h @@ -36,18 +36,18 @@ namespace units { template using time = quantity; - struct nanosecond : unit {}; - template<> struct upcasting_traits> : upcast_to {}; - - struct microsecond : unit {}; - template<> struct upcasting_traits> : upcast_to {}; - - struct millisecond : unit {}; - template<> struct upcasting_traits> : upcast_to {}; - struct second : unit> {}; template<> struct upcasting_traits> : upcast_to {}; + struct nanosecond : nano {}; + template<> struct upcasting_traits> : upcast_to {}; + + struct microsecond : micro {}; + template<> struct upcasting_traits> : upcast_to {}; + + struct millisecond : milli {}; + template<> struct upcasting_traits> : upcast_to {}; + struct minute : unit> {}; template<> struct upcasting_traits> : upcast_to {}; diff --git a/src/include/units/unit.h b/src/include/units/unit.h index fed8ff3b..edb68f94 100644 --- a/src/include/units/unit.h +++ b/src/include/units/unit.h @@ -112,4 +112,21 @@ namespace units { template using derived_unit = unit::ratio>; + // prefixes + template using atto = unit>; + template using femto = unit>; + template using pico = unit>; + template using nano = unit>; + template using micro = unit>; + template using milli = unit>; + template using centi = unit>; + template using deca = unit>; + template using hecto = unit>; + template using kilo = unit>; + template using mega = unit>; + template using giga = unit>; + template using tera = unit>; + template using peta = unit>; + template using exa = unit>; + } // namespace units