mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-05 13:14:29 +02:00
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`,
|
||||
`Quantity` and `QuantityPoint`:
|
||||
`Quantity`, and `QuantityPoint`:
|
||||
|
||||
.. image:: /_static/img/concepts.png
|
||||
: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.
|
||||
|
||||
`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)
|
||||
<< '\n';
|
||||
std::cout << "Point: " << quantity_point_cast<decltype(quantity_point{0q_m})>(d) << '\n';
|
||||
|
||||
.. seealso::
|
||||
|
||||
|
@@ -81,21 +81,24 @@ The result will always be a quantity point of the same dimension:
|
||||
|
||||
.. code-block::
|
||||
:emphasize-lines: 3
|
||||
|
||||
Length auto dist1 = 2q_m;
|
||||
Length auto dist2 = 1q_m;
|
||||
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:
|
||||
|
||||
.. code-block::
|
||||
:emphasize-lines: 3
|
||||
|
||||
Length auto dist1 = 2q_m;
|
||||
Length auto dist2 = 1q_m;
|
||||
Length auto res1 = quantity_point{dist1} - quantity_point{dist2};
|
||||
|
||||
That's it! You can't multiply nor divide quantity points with anything else.
|
||||
|
||||
|
||||
Base Dimensions
|
||||
---------------
|
||||
|
||||
|
@@ -31,10 +31,11 @@ the value to the `quantity_point` class template explicit constructor::
|
||||
Differences to quantity
|
||||
-----------------------
|
||||
|
||||
Unlike `quantity`, the library provides
|
||||
- no helper aliases for quantity points, such as `length_point`,
|
||||
Unlike `quantity`, the library provides:
|
||||
|
||||
- no helper aliases for quantity points, such as ``length_point``,
|
||||
- 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`),
|
||||
- a more limited set of operations on quantity points
|
||||
(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
|
||||
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:
|
||||
|
||||
.. code-block::
|
||||
@@ -37,7 +37,7 @@ and pass it to the library's output:
|
||||
legacy::print_eta(quantity_cast<si::metre_per_second>(v).count());
|
||||
}
|
||||
|
||||
template <QuantityPoint QP>
|
||||
template<QuantityPoint QP>
|
||||
requires Length<typename QP::quantity_type>
|
||||
void set_path_position(QP p)
|
||||
{
|
||||
|
Reference in New Issue
Block a user