feat: 💥 RepresentationOf concept now also accepts a QuantitySpec and accepts any representation character for quantity kinds
This commit is contained in:
1 parent
75b50b8d2c
commit
da50348115
14 files changed
+88
-76
No files matched your search
@@ -148,7 +148,7 @@ As we remember, the `quantity` class template is defined as follows:
|
||||
|
||||
```cpp
|
||||
template<Reference auto R,
|
||||
RepresentationOf<get_quantity_spec(R).character> Rep = double>
|
||||
RepresentationOf<get_quantity_spec(R)> Rep = double>
|
||||
class quantity;
|
||||
```
|
||||
|
||||
|
||||
@@ -159,15 +159,28 @@ A `Reference` can either be:
|
||||
[value of a quantity](../../appendix/glossary.md#quantity-value).
|
||||
|
||||
|
||||
### `RepresentationOf<T, Ch>` { #RepresentationOf }
|
||||
### `RepresentationOf<T, V>` { #RepresentationOf }
|
||||
|
||||
`RepresentationOf` concept is satisfied by all `Representation` types that are of a specified
|
||||
[quantity character](../../appendix/glossary.md#character) `Ch`.
|
||||
`RepresentationOf` concept is satisfied:
|
||||
|
||||
- if the type of `V` satisfies [`QuantitySpec`](#QuantitySpec):
|
||||
|
||||
- by all [`Representation`](#Representation) types when `V` describes
|
||||
a [quantity kind](../../appendix/glossary.md#kind),
|
||||
- otherwise, by [`Representation`](#Representation) types that are of
|
||||
a [quantity character](../../appendix/glossary.md#character) associated with a provided
|
||||
quantity specification `V`.
|
||||
|
||||
- if `V` is of `quantity_character` type:
|
||||
|
||||
- by [`Representation`](#Representation) types that are of a provided
|
||||
[quantity character](../../appendix/glossary.md#character).
|
||||
|
||||
A user can declare a custom representation type to be of a specific character by providing the specialization
|
||||
with `true` for one or more of the following variable templates:
|
||||
|
||||
- `is_scalar<T>`
|
||||
- `is_complex<T>`
|
||||
- `is_vector<T>`
|
||||
- `is_tensor<T>`
|
||||
|
||||
|
||||
@@ -316,7 +316,7 @@ This is why a `quantity` class template is defined in the library as:
|
||||
|
||||
```cpp
|
||||
template<Reference auto R,
|
||||
RepresentationOf<get_quantity_spec(R).character> Rep = double>
|
||||
RepresentationOf<get_quantity_spec(R)> Rep = double>
|
||||
class quantity;
|
||||
```
|
||||
|
||||
@@ -365,7 +365,7 @@ In the **mp-units** library, the quantity point is implemented as:
|
||||
```cpp
|
||||
template<Reference auto R,
|
||||
PointOriginFor<get_quantity_spec(R)> auto PO,
|
||||
RepresentationOf<get_quantity_spec(R).character> Rep = double>
|
||||
RepresentationOf<get_quantity_spec(R)> Rep = double>
|
||||
class quantity_point;
|
||||
```
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ In the **mp-units** library, a quantity is represented with the following class
|
||||
|
||||
```cpp
|
||||
template<Reference auto R,
|
||||
RepresentationOf<get_quantity_spec(R).character> Rep = double>
|
||||
RepresentationOf<get_quantity_spec(R)> Rep = double>
|
||||
class quantity;
|
||||
```
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ origin:
|
||||
```cpp
|
||||
template<Reference auto R,
|
||||
PointOriginFor<get_quantity_spec(R)> auto PO = default_point_origin(R),
|
||||
RepresentationOf<get_quantity_spec(R).character> Rep = double>
|
||||
RepresentationOf<get_quantity_spec(R)> Rep = double>
|
||||
class quantity_point;
|
||||
```
|
||||
|
||||
|
||||
Reference in new issue
Block a user