forked from mpusz/mp-units
docs: quantity_point documentation fixed
This commit is contained in:
@@ -4,7 +4,7 @@ Basic Concepts
|
|||||||
==============
|
==============
|
||||||
|
|
||||||
The most important concepts in the library are `Unit`, `Dimension`,
|
The most important concepts in the library are `Unit`, `Dimension`,
|
||||||
`Quantity` and `QuantityPoint`:
|
`Quantity`, and `QuantityPoint`:
|
||||||
|
|
||||||
.. image:: /_static/img/concepts.png
|
.. image:: /_static/img/concepts.png
|
||||||
:align: center
|
:align: center
|
||||||
|
@@ -90,10 +90,9 @@ once and leave the rest intact:
|
|||||||
- line #3 sets only a representation type to the type provided by the user.
|
- line #3 sets only a representation type to the type provided by the user.
|
||||||
|
|
||||||
`quantity_point_cast` takes anything that works for `quantity_point`
|
`quantity_point_cast` takes anything that works for `quantity_point`
|
||||||
or a specific target `quantity_point`:
|
or a specific target `quantity_point`::
|
||||||
|
|
||||||
std::cout << "Point: " << quantity_point_cast<decltype(quantity_point{0q_m})>(d)
|
std::cout << "Point: " << quantity_point_cast<decltype(quantity_point{0q_m})>(d) << '\n';
|
||||||
<< '\n';
|
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
|
@@ -81,21 +81,24 @@ The result will always be a quantity point of the same dimension:
|
|||||||
|
|
||||||
.. code-block::
|
.. code-block::
|
||||||
:emphasize-lines: 3
|
:emphasize-lines: 3
|
||||||
|
|
||||||
Length auto dist1 = 2q_m;
|
Length auto dist1 = 2q_m;
|
||||||
Length auto dist2 = 1q_m;
|
Length auto dist2 = 1q_m;
|
||||||
auto res1 = dist1 - quantity_point{dist2}; // ERROR
|
auto res1 = dist1 - quantity_point{dist2}; // ERROR
|
||||||
|
|
||||||
We can also substract two quantity points.
|
We can also subtract two quantity points.
|
||||||
The result is a relative quantity of the same dimension:
|
The result is a relative quantity of the same dimension:
|
||||||
|
|
||||||
.. code-block::
|
.. code-block::
|
||||||
:emphasize-lines: 3
|
:emphasize-lines: 3
|
||||||
|
|
||||||
Length auto dist1 = 2q_m;
|
Length auto dist1 = 2q_m;
|
||||||
Length auto dist2 = 1q_m;
|
Length auto dist2 = 1q_m;
|
||||||
Length auto res1 = quantity_point{dist1} - quantity_point{dist2};
|
Length auto res1 = quantity_point{dist1} - quantity_point{dist2};
|
||||||
|
|
||||||
That's it! You can't multiply nor divide quantity points with anything else.
|
That's it! You can't multiply nor divide quantity points with anything else.
|
||||||
|
|
||||||
|
|
||||||
Base Dimensions
|
Base Dimensions
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
@@ -31,10 +31,11 @@ the value to the `quantity_point` class template explicit constructor::
|
|||||||
Differences to quantity
|
Differences to quantity
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
Unlike `quantity`, the library provides
|
Unlike `quantity`, the library provides:
|
||||||
- no helper aliases for quantity points, such as `length_point`,
|
|
||||||
|
- no helper aliases for quantity points, such as ``length_point``,
|
||||||
- no UDLs for quantity points,
|
- no UDLs for quantity points,
|
||||||
- no dimension-specific concepts, such as `LengthPoint`
|
- no dimension-specific concepts, such as ``LengthPoint``
|
||||||
(there's the dimension-agnostic `QuantityPoint`),
|
(there's the dimension-agnostic `QuantityPoint`),
|
||||||
- a more limited set of operations on quantity points
|
- a more limited set of operations on quantity points
|
||||||
(see the :ref:`Conversions and Casting` chapter)
|
(see the :ref:`Conversions and Casting` chapter)
|
||||||
|
@@ -5,7 +5,7 @@ Working with Legacy Interfaces
|
|||||||
|
|
||||||
In case we are working with a legacy/unsafe interface we may be forced to
|
In case we are working with a legacy/unsafe interface we may be forced to
|
||||||
extract the :term:`value of a quantity` with :func:`quantity::count()` or to
|
extract the :term:`value of a quantity` with :func:`quantity::count()` or to
|
||||||
extract the :term:`value of a quantity_point` with :func:`quantity_point::relative()`
|
extract the value of a `quantity_point` with :func:`quantity_point::relative()`
|
||||||
and pass it to the library's output:
|
and pass it to the library's output:
|
||||||
|
|
||||||
.. code-block::
|
.. code-block::
|
||||||
|
Reference in New Issue
Block a user