Skip to content

Commit

Permalink
docs: 2.2 release announcement updated
Browse files Browse the repository at this point in the history
  • Loading branch information
mpusz committed Apr 25, 2024
1 parent a5b2b79 commit dbc2259
Showing 1 changed file with 44 additions and 7 deletions.
51 changes: 44 additions & 7 deletions docs/blog/posts/2.2.0-released.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ significant changes introduced by the new version can be found in our

<!-- more -->

## C++20 modules
## C++20 modules and project structure cleanup

[GitHub Issue #7](https://github.com/mpusz/mp-units/issues/7) was our oldest open issue
before this release. Not anymore. After 4.5 years, we finally closed it, even though
Expand Down Expand Up @@ -90,9 +90,46 @@ In version 2.2, the following headers have a new location or contents:
| _mp-units/systems/angular/math.h_ | `mp_units.systems` | Trigonometric functions using `angular::radian` |
| _mp-units/systems/si/chrono.h_ | `mp_units.systems` | `std::chrono` compatibility traits |

Benefiting from this opportunity, we also cleaned up core and systems definitions
(:boom: **breaking change** :boom:).

Regarding the library's core, we exposed only one header `framework.h` that exposes all of
the library's framework so the user does not have to enumerate files like `unit.h`, `quantity.h`,
and `quantity_point.h` anymore. Those headers are not gone, they were put to
the `mp-units/framework` subheader. So they are still there if you really need them.

Regarding the changes in systems definitions, we moved the wrapper header files with the entire
system definition to the `mp-units/systems` subdirectory. Additionally, they now also include
`framework.h`, so a system include is enough to use the library. Thanks to that our users don't
have to write tedious code like the below anymore:

=== "Now"

```cpp
#include <mp-units/systems/cgs.h>
#include <mp-units/systems/international.h>
#include <mp-units/systems/isq.h>
#include <mp-units/systems/si.h>

// ...
```

=== "Before"

```cpp
#include <mp-units/quantity_point.h>
#include <mp-units/systems/cgs/cgs.h>
#include <mp-units/systems/international/international.h>
#include <mp-units/systems/isq/isq.h>
#include <mp-units/systems/si/si.h>

// ...
```

Additionally, we merged all of the compatibility-related macros into one header file
_mp-units/compat_macros.h_. This header file should be explicitly included before importing C++
modules if we want to benefit from the [Wide Compatibility tools](../../users_guide/use_cases/wide_compatibility.md).
`mp-units/compat_macros.h`. This header file should be explicitly included before importing C++
modules if we want to benefit from the
[Wide Compatibility tools](../../users_guide/use_cases/wide_compatibility.md).


## Better control over the library's API
Expand Down Expand Up @@ -383,13 +420,13 @@ Also, the header itself was split into smaller pieces that improve C++20 modules

## `ratio` made an implementation detail of the library

We decided not to expose `ratio` and associated types in the public interface of the library
We decided not to expose `ratio` and associated interfaces in the public part of the library
(:boom: **breaking change** :boom:). Standardization of it could be problematic as we have
[`std::ratio`](https://en.cppreference.com/w/cpp/numeric/ratio/ratio) already.

Alternatively, we introduced a new helper called `mag_ratio` to provide the magnitude of the unit
defined in terms of a rational conversion factor. Here is a comparison of the code with previous
and current definitions:
Alternatively, as in the public interface it was always only used with `mag`, we introduced a new
helper called `mag_ratio` to provide the magnitude of the unit defined in terms of a rational
conversion factor. Here is a comparison of the code with previous and current definitions:

=== "Now"

Expand Down

0 comments on commit dbc2259

Please sign in to comment.