feat: quantity point-like support

This commit is contained in:
Johel Ernesto Guerrero Peña
2021-02-17 19:40:52 +01:00
committed by Mateusz Pusz
parent 86584dbfe2
commit 8d6d43b32d
11 changed files with 110 additions and 2 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
- **0.7.0 WIP**
- (!) refactor: `ScalableNumber` renamed to `QuantityValue`
- (!) refactor: output stream operators moved to the `units/quantity_io.h` header file
- refactor: `quantity_point` (partially) updated to reflect latest changes to `quantity`
- refactor: quantity (kind) point updated to reflect latest changes to `quantity`
- refactor: basic concepts, `quantity` and `quantity_cast` refactored
- refactor: `abs()` definition refactored to be more explicit about the return type
- feat: quantity (point) kind support added (thanks [@johelegp](https://github.com/johelegp))
@@ -8,3 +8,6 @@ Customization Points
.. doxygenstruct:: units::quantity_like_traits
:members:
.. doxygenstruct:: units::quantity_point_like_traits
:members:
+11
View File
@@ -53,3 +53,14 @@ such an explicit conversion::
using namespace std::chrono_literals;
quantity q = 1s; // ERROR
For external quantity point-like types, `quantity_point_like_traits` is also provided.
It works just like `quantity_like_traits`, except that
``count(T)`` is replaced with ``relative(T)`` that returns the `QuantityLike` value.
Similar to `quantity` and `quantity_kind`, `quantity_point` and `quantity_kind_point`
provide a deduction guide from `QuantityPointLike`::
using namespace std::chrono_literals;
static_assert(quantity_point{std::chrono::sys_seconds{1s}} + 1_q_s == quantity_point{2s});