diff --git a/include/xo/unit/basis_unit.hpp b/include/xo/unit/basis_unit.hpp index 3cd73437..ed0b0a54 100644 --- a/include/xo/unit/basis_unit.hpp +++ b/include/xo/unit/basis_unit.hpp @@ -91,6 +91,15 @@ namespace xo { constexpr basis_unit megameter = megametre; constexpr basis_unit gigameter = gigametre; + /** @brief basis-unit representing 1 inch; defined as exactly 1/12 feet **/ + constexpr basis_unit inch = basis_unit(dim::distance, scalefactor_ratio_type( 3048, 120000)); + /** @brief basis-unit representing 1 foot; defined as exactly 0.3048 meters **/ + constexpr basis_unit foot = basis_unit(dim::distance, scalefactor_ratio_type( 3048, 10000)); + /** @brief basis-unit representing 1 yard; defined as exactly 3 feet **/ + constexpr basis_unit yard = basis_unit(dim::distance, scalefactor_ratio_type( 3*3048, 10000)); + /** @brief basis-unit representing 1 mile; defined as exactly 1760 yards = 5280 feet **/ + constexpr basis_unit mile = basis_unit(dim::distance, scalefactor_ratio_type( 5280*3048, 10000)); + // ----- time ----- constexpr basis_unit picosecond = basis_unit(dim::time, scalefactor_ratio_type( 1, 1000000000000)); diff --git a/include/xo/unit/natural_unit.hpp b/include/xo/unit/natural_unit.hpp index 0acbd93f..7dfe3447 100644 --- a/include/xo/unit/natural_unit.hpp +++ b/include/xo/unit/natural_unit.hpp @@ -369,6 +369,8 @@ namespace xo { namespace nu { constexpr auto dimensionless = natural_unit(); + // ----- mass ----- + constexpr auto picogram = natural_unit::from_bu(bu::picogram); constexpr auto nanogram = natural_unit::from_bu(bu::nanogram); constexpr auto microgram = natural_unit::from_bu(bu::microgram); @@ -380,6 +382,8 @@ namespace xo { constexpr auto megatonne = natural_unit::from_bu(bu::megatonne); constexpr auto gigatonne = natural_unit::from_bu(bu::gigatonne); + // ----- distance ----- + constexpr auto picometer = natural_unit::from_bu(bu::picometer); constexpr auto nanometer = natural_unit::from_bu(bu::nanometer); constexpr auto micrometer = natural_unit::from_bu(bu::micrometer); @@ -391,6 +395,13 @@ namespace xo { constexpr auto lightsecond = natural_unit::from_bu(bu::lightsecond); constexpr auto astronomicalunit = natural_unit::from_bu(bu::astronomicalunit); + constexpr auto inch = natural_unit::from_bu(bu::inch); + constexpr auto foot = natural_unit::from_bu(bu::foot); + constexpr auto yard = natural_unit::from_bu(bu::yard); + constexpr auto mile = natural_unit::from_bu(bu::mile); + + // ----- time ----- + constexpr auto picosecond = natural_unit::from_bu(bu::picosecond); constexpr auto nanosecond = natural_unit::from_bu(bu::nanosecond); constexpr auto microsecond = natural_unit::from_bu(bu::microsecond); diff --git a/include/xo/unit/quantity.hpp b/include/xo/unit/quantity.hpp index fcd44391..621b206b 100644 --- a/include/xo/unit/quantity.hpp +++ b/include/xo/unit/quantity.hpp @@ -425,6 +425,18 @@ namespace xo { template inline constexpr auto astronomicalunits(Repr x) { return quantity(x); } + /** @brief create quantity representing @p x inches of distance, with compile-time unit representation **/ + template + inline constexpr auto inches(Repr x) { return quantity(x); } + /** @brief create quantity representing @p x feet of distance, with compile-time unit representation **/ + template + inline constexpr auto feet(Repr x) { return quantity(x); } + /** @brief create quantity representing @p x yards of distance, with compile-time unit representation **/ + template + inline constexpr auto yards(Repr x) { return quantity(x); } + /** @brief create quantity representing @p x statute miles of distance, with compile-time unit representation **/ + template + inline constexpr auto miles(Repr x) { return quantity(x); } static constexpr auto meter = meters(1); // ----- time -----