docs: mention quantity_point where appropriate

This commit is contained in:
Johel Ernesto Guerrero Peña authored and Mateusz Pusz committed 2020-08-18 08:52:22 +02:00
1 parent 530fb41ada
commit 746ac178e4
6 files changed
+63 -7

No files matched your search

+12 -2
View File
@@ -4,8 +4,9 @@ Working with Legacy Interfaces
==============================
In case we are working with a legacy/unsafe interface we may be forced to
extract a :term:`value of a quantity` with :func:`quantity::count()` and
pass it to the library's output:
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()`
and pass it to the library's output:
.. code-block::
:caption: legacy.h
@@ -13,6 +14,7 @@ pass it to the library's output:
namespace legacy {
void print_eta(double speed_in_mps);
void set_path_position(double meter);
} // namespace legacy
@@ -20,6 +22,7 @@ pass it to the library's output:
#include "legacy.h"
#include <units/physical/si/speed.h>
#include <units/quantity_point.h>
using namespace units::physical;
@@ -34,6 +37,13 @@ pass it to the library's output:
legacy::print_eta(quantity_cast<si::metre_per_second>(v).count());
}
template <QuantityPoint QP>
requires Length<typename QP::quantity_type>
void set_path_position(QP p)
{
legacy::set_path_position(quantity_point_cast<si::metre>(p).relative().count());
}
.. important::
When dealing with a quantity of an unknown ``auto`` type please remember