From 24b609173d6cf6879dca373fda94644b2b4f98e8 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Tue, 7 May 2024 10:43:57 -0400 Subject: [PATCH] xo-unit: + unit distance constants --- include/xo/unit/quantity.hpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/include/xo/unit/quantity.hpp b/include/xo/unit/quantity.hpp index b3da2d53..9e62cd7e 100644 --- a/include/xo/unit/quantity.hpp +++ b/include/xo/unit/quantity.hpp @@ -411,6 +411,7 @@ namespace xo { static constexpr auto kilotonne = kilotonnes(1); } /*namespace qty*/ + namespace qty { // ----- distance ----- template @@ -447,8 +448,32 @@ namespace xo { /** @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); + /** @brief a quantity representing 1 picometer of distance, with compile-time unit representation **/ + static constexpr auto picometer = picometers(1); + /** @brief a quantity representing 1 nanometer of distance, with compile-time unit representation **/ + static constexpr auto nanometer = nanometers(1); + /** @brief a quantity representing 1 micrometer of distance, with compile-time unit representation **/ + static constexpr auto micrometer = micrometers(1); + /** @brief a quantity representing 1 millimeter of distance, with compile-time unit representation **/ + static constexpr auto millimeter = millimeters(1); + /** @brief a quantity representing 1 meter of distance, with compile-time unit representation **/ + static constexpr auto meter = meters(1); + /** @brief a quantity representing 1 kilometer of distance, with compile-time unit representation **/ + static constexpr auto kilometer = kilometers(1); + /** @brief a quantity representing 1 megameter of distance, with compile-time unit representation **/ + static constexpr auto megameter = megameters(1); + /** @brief a quantity representing 1 gigameter of distance, with compile-time unit representation **/ + static constexpr auto gigameter = gigameters(1); + + /** @brief a quantity representing exactly 1 lightsecond of distance, with compile-time unit representation **/ + static constexpr auto lightsecond = lightseconds(1); + /** @brief a quantity representing exactly 1 astronomical unit of distance, with compile-time unit representation **/ + static constexpr auto astronomicalunit = astronomicalunits(1); + + } /*namespace qty*/ + + namespace qty { // ----- time ----- template @@ -484,6 +509,7 @@ namespace xo { inline constexpr auto year365s(Repr x) { return quantity(x); } static constexpr auto second = seconds(1); + } /*namespace qty*/ // ----- volatility -----