"Scenarios" chapter renamed to "Use cases"
This commit is contained in:
1 parent
034f239f96
commit
5d06b66316
9 files changed
+33
-29
No files matched your search
@@ -0,0 +1,7 @@
|
||||
.. namespace:: units
|
||||
|
||||
Using Custom Representation Types
|
||||
=================================
|
||||
|
||||
Customization points
|
||||
--------------------
|
||||
@@ -0,0 +1,19 @@
|
||||
.. namespace:: units
|
||||
|
||||
Extending the library
|
||||
=====================
|
||||
|
||||
Custom Units
|
||||
------------
|
||||
|
||||
Custom Dimensions
|
||||
-----------------
|
||||
|
||||
Custom Base Dimensions
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Custom Derived Dimensions
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Custom Systems
|
||||
--------------
|
||||
@@ -0,0 +1,41 @@
|
||||
.. namespace:: units
|
||||
|
||||
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:
|
||||
|
||||
.. code-block::
|
||||
:caption: legacy.h
|
||||
|
||||
namespace legacy {
|
||||
|
||||
void print_eta(double speed_in_mps);
|
||||
|
||||
} // namespace legacy
|
||||
|
||||
.. code-block::
|
||||
|
||||
#include "legacy.h"
|
||||
#include <units/physical/si/velocity.h>
|
||||
|
||||
using namespace units;
|
||||
|
||||
constexpr Velocity auto avg_speed(Length auto d, Time auto t)
|
||||
{
|
||||
return d / t;
|
||||
}
|
||||
|
||||
void print_eta(Length auto d, Time auto t)
|
||||
{
|
||||
Velocity auto v = avg_speed(d, t);
|
||||
legacy::print_eta(quantity_cast<si::metre_per_second>(v).count());
|
||||
}
|
||||
|
||||
.. important::
|
||||
|
||||
When dealing with a quantity of an unknown ``auto`` type please remember
|
||||
to always use `quantity_cast` to cast it to a desired unit before calling
|
||||
`quantity::count()` and passing the raw value to the legacy/unsafe interface.
|
||||
@@ -0,0 +1,9 @@
|
||||
.. namespace:: units
|
||||
|
||||
Working with Unknown Units and Dimensions
|
||||
=========================================
|
||||
|
||||
- what is an unknown unit?
|
||||
- what is an unknown dimension?
|
||||
- temporary result
|
||||
- casting to the coherent unit
|
||||
Reference in new issue
Block a user