From d891e866dcb76f601fc3e0463cb1818672a9387a Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Fri, 17 Jan 2025 12:15:50 +0100 Subject: [PATCH] docs: "Should we get rid of a `quantity_point`?" chapter extended with an alternative solution --- ...nging-quantity-safety-to-the-next-level.md | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/docs/blog/posts/bringing-quantity-safety-to-the-next-level.md b/docs/blog/posts/bringing-quantity-safety-to-the-next-level.md index faeebbdd..0c8a9cc3 100644 --- a/docs/blog/posts/bringing-quantity-safety-to-the-next-level.md +++ b/docs/blog/posts/bringing-quantity-safety-to-the-next-level.md @@ -639,13 +639,22 @@ to know the context in which the `quantity_spec` is being used. This sucks! ### Should we get rid of a `quantity_point`? -A solution to the above might be removing a dedicated `quantity_point` abstraction and providing both -functionalities through the `quantity` class template. In order to determine if we are dealing with -a "delta" or "point", we would need a special wrapper around the `QuantityReference` and -`quantity_spec`. +There are at least two ways of solving the above issue. In any case, we need to introduce a wrapper +over the `quantity_spec` to denote it is being used in a "point" abstraction. -I still haven't figured out the best syntax. Please let me know if you have good ideas in the -comments below. Here are some rough ideas: +A simpler solution could be implicitly amending the `Reference` provided to the `quantity_point` +class template with `point<...>`. So, for example, we would have the following members in +`quantity_point`: + +- `qp::quantity_spec == point`, +- `qp::reference` of a type `reference, si::metre>`. + +This should work but might be a bit confusing as members of the class template would not exactly +contain the types of template parameters. + +A better solution might be removing a dedicated `quantity_point` abstraction and providing both +functionalities through the `quantity` class template. I still haven't figured out the best syntax. +Please let me know if you have good ideas in the comments below. Here are some rough ideas: | Before | After | `quantity_spec` | |----------------------------------------------------|-----------------------------------------------------|-------------------------------|