mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-02 11:54:27 +02:00
@@ -14,6 +14,7 @@ Framework Basics
|
|||||||
framework/basic_concepts
|
framework/basic_concepts
|
||||||
framework/quantities
|
framework/quantities
|
||||||
framework/quantity_points
|
framework/quantity_points
|
||||||
|
framework/quantity_kinds
|
||||||
framework/dimensions
|
framework/dimensions
|
||||||
framework/units
|
framework/units
|
||||||
framework/constants
|
framework/constants
|
||||||
|
@@ -12,7 +12,7 @@ It is represented in the library with a `quantity_kind` class template.
|
|||||||
Kind creation
|
Kind creation
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
We need a `kind` to represent the more specific usage of a quantity.
|
We need a `kind` to represent the more specific usage of a quantity::
|
||||||
|
|
||||||
struct radius : kind<radius, si::dim_length> {};
|
struct radius : kind<radius, si::dim_length> {};
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ Unlike `quantity`, the library provides:
|
|||||||
* no kind-specific concepts, such as ``Radius``,
|
* no kind-specific concepts, such as ``Radius``,
|
||||||
(there's the generic `QuantityKind` and kind-specifiable `QuantityKindOf`),
|
(there's the generic `QuantityKind` and kind-specifiable `QuantityKindOf`),
|
||||||
- a slightly different set of operations on quantity kinds
|
- a slightly different set of operations on quantity kinds
|
||||||
(see the :ref:`Dimensions` chapter)
|
(see the :ref:`Dimensions` chapter).
|
||||||
|
|
||||||
Quantity point kind
|
Quantity point kind
|
||||||
-------------------
|
-------------------
|
||||||
@@ -60,12 +60,12 @@ A quantity point kind is the analogous of a quantity point for quantity kinds.
|
|||||||
|
|
||||||
They are represented in the library with a `quantity_point_kind` class template.
|
They are represented in the library with a `quantity_point_kind` class template.
|
||||||
|
|
||||||
First, we need a `point_kind` for a `kind`.
|
First, we need a `point_kind` for a `kind`::
|
||||||
|
|
||||||
struct width : kind<width, si::dim_length> {};
|
struct width : kind<width, si::dim_length> {};
|
||||||
struct x_coordinate : point_kind<x_coordinate, width> {};
|
struct x_coordinate : point_kind<x_coordinate, width> {};
|
||||||
|
|
||||||
Now x coordinates can be constructed:
|
Now ``x`` coordinates can be constructed::
|
||||||
|
|
||||||
quantity_point_kind<x_coordinate, si::metre, int> auto x_pos(123 * m);
|
quantity_point_kind<x_coordinate, si::metre, int> auto x_pos(123 * m);
|
||||||
// `QuantityPointKindOf<x_coordinate>` with `x_pos.relative()`
|
// `QuantityPointKindOf<x_coordinate>` with `x_pos.relative()`
|
||||||
|
Reference in New Issue
Block a user