mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-31 19:04:27 +02:00
docs: 2.2 release announcement updated
This commit is contained in:
@@ -21,7 +21,7 @@ significant changes introduced by the new version can be found in our
|
|||||||
|
|
||||||
<!-- more -->
|
<!-- 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
|
[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
|
before this release. Not anymore. After 4.5 years, we finally closed it, even though
|
||||||
@@ -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/angular/math.h_ | `mp_units.systems` | Trigonometric functions using `angular::radian` |
|
||||||
| _mp-units/systems/si/chrono.h_ | `mp_units.systems` | `std::chrono` compatibility traits |
|
| _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
|
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++
|
`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).
|
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
|
## Better control over the library's API
|
||||||
@@ -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
|
## `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
|
(: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.
|
[`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
|
Alternatively, as in the public interface it was always only used with `mag`, we introduced a new
|
||||||
defined in terms of a rational conversion factor. Here is a comparison of the code with previous
|
helper called `mag_ratio` to provide the magnitude of the unit defined in terms of a rational
|
||||||
and current definitions:
|
conversion factor. Here is a comparison of the code with previous and current definitions:
|
||||||
|
|
||||||
=== "Now"
|
=== "Now"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user