Skip to content

Commit

Permalink
docs: 2.2 release annonuncement updated
Browse files Browse the repository at this point in the history
  • Loading branch information
mpusz committed Jun 6, 2024
1 parent 68da34a commit 7319e78
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions docs/blog/posts/2.2.0-released.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>` 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
Expand All @@ -272,7 +282,7 @@ is why it was renamed to `symbol_text` (:boom: **breaking change** :boom:).
=== "Now"

```cpp
inline constexpr struct ohm : named_unit<symbol_text{u8"Ω", "ohm"}, volt / ampere> {} ohm;
inline constexpr struct ohm final : named_unit<symbol_text{u8"Ω", "ohm"}, volt / ampere> {} ohm;
```

=== "Before"
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 7319e78

Please sign in to comment.