From dd55a52675e8d52c23de2b95ed4ad3249dbac9af Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Sun, 6 Oct 2024 08:32:38 +0200 Subject: [PATCH] feat: alternative litre unit symbol `L` added to prevent ambiguities with `1` --- docs/users_guide/framework_basics/text_output.md | 4 ++-- src/systems/include/mp-units/systems/si/unit_symbols.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/users_guide/framework_basics/text_output.md b/docs/users_guide/framework_basics/text_output.md index 9731c360c..4d676fdcc 100644 --- a/docs/users_guide/framework_basics/text_output.md +++ b/docs/users_guide/framework_basics/text_output.md @@ -275,7 +275,7 @@ In most cases [scaled units are hidden behind named units](systems_of_units.md#s However, there are a few real-life where a user directly faces a scaled unit. For example: ```cpp -constexpr Unit auto l_per_100km = l / (mag<100> * km); +constexpr Unit auto L_per_100km = L / (mag<100> * km); ``` The above is a derived unit of litre divided by a scaled unit of 100 kilometers. As we can @@ -283,7 +283,7 @@ see a scaled unit has a magnitude and a reference unit. To denote the scope of s a unit, we enclose it in `[...]`. For example, the following: ```cpp -std::cout << 6.7 * l_per_100km << "\n"; +std::cout << 6.7 * L_per_100km << "\n"; ``` prints: diff --git a/src/systems/include/mp-units/systems/si/unit_symbols.h b/src/systems/include/mp-units/systems/si/unit_symbols.h index 466c956ce..ad004f8cc 100644 --- a/src/systems/include/mp-units/systems/si/unit_symbols.h +++ b/src/systems/include/mp-units/systems/si/unit_symbols.h @@ -791,6 +791,7 @@ inline constexpr auto arcsec = arcsecond; inline constexpr auto a = are; inline constexpr auto ha = hectare; inline constexpr auto l = litre; +inline constexpr auto L = litre; // both versions of litre are allowed inline constexpr auto t = tonne; inline constexpr auto Da = dalton; inline constexpr auto eV = electronvolt;