From 7fc88facd6ad9580ffcdc45d04667246bbcc3df9 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Mon, 19 Jun 2023 14:01:36 +0200 Subject: [PATCH] feat: `arcminute` and `arcsecond` support added --- src/systems/si/include/mp-units/systems/si/unit_symbols.h | 2 ++ src/systems/si/include/mp-units/systems/si/units.h | 5 ++--- test/unit_test/static/si_test.cpp | 3 +++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/systems/si/include/mp-units/systems/si/unit_symbols.h b/src/systems/si/include/mp-units/systems/si/unit_symbols.h index 8e37c53f..43ea5cd1 100644 --- a/src/systems/si/include/mp-units/systems/si/unit_symbols.h +++ b/src/systems/si/include/mp-units/systems/si/unit_symbols.h @@ -733,6 +733,8 @@ inline constexpr auto Qkat = quetta; // TODO Should the following non-SI units have prefixes symbols predefiend as well? inline constexpr auto au = astronomical_unit; inline constexpr auto deg = degree; +inline constexpr auto arcmin = arcminute; +inline constexpr auto arcsec = arcsecond; inline constexpr auto a = are; inline constexpr auto ha = hectare; inline constexpr auto l = litre; diff --git a/src/systems/si/include/mp-units/systems/si/units.h b/src/systems/si/include/mp-units/systems/si/units.h index c15add79..41543f5b 100644 --- a/src/systems/si/include/mp-units/systems/si/units.h +++ b/src/systems/si/include/mp-units/systems/si/units.h @@ -82,9 +82,8 @@ inline constexpr struct hour : named_unit<"h", mag<60> * minute> {} hour; inline constexpr struct day : named_unit<"d", mag<24> * hour> {} day; inline constexpr struct astronomical_unit : named_unit<"au", mag<149'597'870'700> * metre> {} astronomical_unit; inline constexpr struct degree : named_unit * radian> {} degree; -// TODO how to disambiguate below angular units from time units (inline namespace `plane_angle`?) -// inline constexpr struct minute : named_unit * degree> {} minute; -// inline constexpr struct second : named_unit * minute> {} second; +inline constexpr struct arcminute : named_unit * degree> {} arcminute; +inline constexpr struct arcsecond : named_unit * arcminute> {} arcsecond; inline constexpr struct are : named_unit<"a", square(deca)> {} are; inline constexpr struct hectare : decltype(hecto) {} hectare; inline constexpr struct litre : named_unit<"l", cubic(deci)> {} litre; diff --git a/test/unit_test/static/si_test.cpp b/test/unit_test/static/si_test.cpp index 47b127de..c75924de 100644 --- a/test/unit_test/static/si_test.cpp +++ b/test/unit_test/static/si_test.cpp @@ -78,6 +78,9 @@ static_assert(1 * d == 24 * h); static_assert(1 * au == 149'597'870'700 * m); +static_assert(60. * arcmin == 1. * deg); +static_assert(60. * arcsec == 1. * arcmin); + static_assert(1 * a == 100 * m2); static_assert(1 * ha == 100 * a);