From 7319e7808882f749845063c90bd66a14b59359cf Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Thu, 6 Jun 2024 13:45:12 +0200 Subject: [PATCH] docs: 2.2 release annonuncement updated --- docs/blog/posts/2.2.0-released.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/blog/posts/2.2.0-released.md b/docs/blog/posts/2.2.0-released.md index 936840a15..7303e57c6 100644 --- a/docs/blog/posts/2.2.0-released.md +++ b/docs/blog/posts/2.2.0-released.md @@ -260,6 +260,16 @@ named with its corresponding unit and with the `si::zeroth_degree_Celsius` ## Changes to units definitions +There were several known issues when units were deriving from each other +(e.g., [#512](https://github.com/mpusz/mp-units/issues/512) and +[#537](https://github.com/mpusz/mp-units/issues/537)). We could either highly complicate the +framework to allow these which could result in much longer compilation times or disallow inheriting +from units at all. We chose the second option. + +With this release all of of the units must be marked as `final`. To enforce this we have changed +the definition of the `Unit` concept, which now requires type `T` to be `final` +(:boom: **breaking change** :boom:). + [WG21 Study Group 16 (Unicode) raised concerns](https://github.com/sg16-unicode/sg16-meetings#january-24th-2024) about potential ABI issues when different translation units are compiled with different ordinary literal encodings. Those issues were resolved with a change to units definitions @@ -272,7 +282,7 @@ is why it was renamed to `symbol_text` (:boom: **breaking change** :boom:). === "Now" ```cpp - inline constexpr struct ohm : named_unit {} ohm; + inline constexpr struct ohm final : named_unit {} ohm; ``` === "Before" @@ -286,7 +296,7 @@ is why it was renamed to `symbol_text` (:boom: **breaking change** :boom:). On C++20-compliant compilers it should be enough to type the following in the unit's definition: ```cpp - inline constexpr struct ohm : named_unit<{u8"Ω", "ohm"}, volt / ampere> {} ohm; + inline constexpr struct ohm final : named_unit<{u8"Ω", "ohm"}, volt / ampere> {} ohm; ``` ## Improved text output @@ -461,8 +471,8 @@ conversion factor. Here is a comparison of the code with previous and current de === "Now" ```cpp - inline constexpr struct yard : named_unit<"yd", mag_ratio<9'144, 10'000> * si::metre> {} yard; - inline constexpr struct foot : named_unit<"ft", mag_ratio<1, 3> * yard> {} foot; + inline constexpr struct yard final : named_unit<"yd", mag_ratio<9'144, 10'000> * si::metre> {} yard; + inline constexpr struct foot final : named_unit<"ft", mag_ratio<1, 3> * yard> {} foot; ``` === "Before"