feat: 💥 inverse() support added for dimensions, quantity_spec, units, and references (1 / s will now create quantity and not a Unit)
This commit is contained in:
1 parent
04588d9c8b
commit
0d66089853
29 files changed
+248
-227
No files matched your search
@@ -152,20 +152,22 @@ identities used in the library:
|
||||
| `QuantitySpec` | `dimensionless` |
|
||||
| `Unit` | `one` |
|
||||
|
||||
In the equations, a user can refer to an identity object either explicitly:
|
||||
In the equations, a user can explicitly refer to an identity object:
|
||||
|
||||
```cpp
|
||||
constexpr auto my_unit = one / second;
|
||||
```
|
||||
|
||||
or implicitly:
|
||||
!!! note
|
||||
|
||||
```cpp
|
||||
constexpr auto my_unit = 1 / second;
|
||||
```
|
||||
Another way to achieve the same result is to call an `inverse()` function:
|
||||
|
||||
Both cases with result in the same expression template being generated and put into the wrapper
|
||||
class template.
|
||||
```cpp
|
||||
constexpr auto my_unit = inverse(second);
|
||||
```
|
||||
|
||||
Both cases will result in the same expression template being generated and put into the wrapper
|
||||
class template.
|
||||
|
||||
|
||||
### Supported operations and their results
|
||||
|
||||
@@ -107,8 +107,8 @@ However, it also explicitly states:
|
||||
The library allows constraining such units in the following way:
|
||||
|
||||
```cpp
|
||||
inline constexpr struct hertz : named_unit<"Hz", 1 / second, kind_of<isq::frequency>> {} hertz;
|
||||
inline constexpr struct becquerel : named_unit<"Bq", 1 / second, kind_of<isq::activity>> {} becquerel;
|
||||
inline constexpr struct hertz : named_unit<"Hz", one / second, kind_of<isq::frequency>> {} hertz;
|
||||
inline constexpr struct becquerel : named_unit<"Bq", one / second, kind_of<isq::activity>> {} becquerel;
|
||||
```
|
||||
|
||||
With the above, `hertz` can only be used for frequencies while becquerel should only be used for
|
||||
|
||||
Reference in new issue
Block a user