From 2a3341df7d557d5c7b5b41ac3416d763a087d516 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Sun, 17 Dec 2023 17:33:35 +0100 Subject: [PATCH] docs: 2.0 release post updated --- docs/blog/posts/2.0.0-released.md | 33 ++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/docs/blog/posts/2.0.0-released.md b/docs/blog/posts/2.0.0-released.md index 4176482b..488aac02 100644 --- a/docs/blog/posts/2.0.0-released.md +++ b/docs/blog/posts/2.0.0-released.md @@ -12,7 +12,8 @@ categories: [GitHub](https://github.com/mpusz/mp-units/releases/tag/v2.0.0) and [Conan](https://conan.io/center/recipes/mp-units?version=2.0.0).** -In this post, we will describe all the changes introduced by the new version. +The list of the most significant changes introduced by the new version can be found in our +[release notes](../../release_notes.md#2.0.0). We will also describe some of them in this post. @@ -39,7 +40,7 @@ Here are the significant changes that the users can observe: - **Header files content and layout** - Previously, all the header files resided in the _include/units_ directory, and now they can be + Previously, all the header files resided in the _include/units_ directory. Now, they can be found in _include/mp-units_. The project file tree was significantly changed as well. Many files were moved to different subdirectories or renamed. @@ -50,10 +51,12 @@ Here are the significant changes that the users can observe: - **Abstractions, interfaces, definitions** - The interfaces of all of the types were refactored, and we have a new way to construct a `quantity` - and `quantity_point`, we got unit symbols, and nearly all of the template arguments are now passed - by values thanks to class NTTP extensions in C++20. Also, systems definitions are much terser now - thanks to a new design approach. + The interfaces of all of the types were refactored. We got unit symbols and a new way + to construct a `quantity` and `quantity_point`. The readability of the generated types was improved thanks + to the introduction of expression templates. Nearly all of the template arguments are now passed + by values thanks to class NTTP extensions in C++20. As a result, unit definitions are much + easier and terser. Also, the V2 has a powerful ability to model systems of quantities and + provides definitions for many ISQ quantities. *[NTTP]: Non-Type Template Parameter @@ -90,13 +93,29 @@ to be considered a good practice here. ### No UDLs anymore -Over the years, we have learned that UDLs are not a good solution either. More information on this +Over the years, we have learned that UDLs are not a good solution. More information on this subject can be found in the [Why don't we use UDLs to create quantities?](../../getting_started/faq.md#why-dont-we-use-udls-to-create-quantities) chapter. *[UDL]: User-Defined Literals +### No construction of a `quantity` from a raw value + +To improve safety, we no longer allow the construction of quantities from raw values. In the new design, we +always need to explicitly specify a unit to create a `quantity`: + +```cpp +quantity q1 = 42 * m; +quantity = 2 * km; +quantity q3(42, si::metre); +``` + +The previous approach was reported to be error-prone under maintenance. More on this subject +can be found in the +[Why can't I create a quantity by passing a number to a constructor?](../../getting_started/faq.md#why-cant-i-create-a-quantity-by-passing-a-number-to-a-constructor) +chapter. + ## New look and feel