mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-02 20:04:27 +02:00
docs: add section on quantity points
This commit is contained in:
committed by
Mateusz Pusz
parent
6c5d763fbb
commit
530fb41ada
@@ -13,6 +13,7 @@ Framework Basics
|
|||||||
|
|
||||||
framework/basic_concepts
|
framework/basic_concepts
|
||||||
framework/quantities
|
framework/quantities
|
||||||
|
framework/quantity_points
|
||||||
framework/dimensions
|
framework/dimensions
|
||||||
framework/units
|
framework/units
|
||||||
framework/constants
|
framework/constants
|
||||||
|
38
docs/framework/quantity_points.rst
Normal file
38
docs/framework/quantity_points.rst
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
.. namespace:: units
|
||||||
|
|
||||||
|
Quantity Points
|
||||||
|
===============
|
||||||
|
|
||||||
|
A :term:`quantity point` is an absolute quantity with respect to zero
|
||||||
|
(which represents some origin) and is represented in the library with a
|
||||||
|
`quantity_point` class template.
|
||||||
|
|
||||||
|
|
||||||
|
Construction
|
||||||
|
------------
|
||||||
|
|
||||||
|
To create the quantity point object from a `quantity` we just have to pass
|
||||||
|
the value to the `quantity_point` class template explicit constructor::
|
||||||
|
|
||||||
|
quantity_point<si::dim_length, si::kilometre, double> d(123q_km);
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
As the constructor is explicit, the quantity object can be created from
|
||||||
|
a quantity only via
|
||||||
|
`direct initialization <https://en.cppreference.com/w/cpp/language/direct_initialization>`_.
|
||||||
|
This is why the code below using
|
||||||
|
`copy initialization <https://en.cppreference.com/w/cpp/language/copy_initialization>`_
|
||||||
|
**does not compile**::
|
||||||
|
|
||||||
|
quantity_point<si::dim_length, si::kilometre, double> d = 123q_km; // ERROR
|
||||||
|
|
||||||
|
|
||||||
|
Differences to quantity
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
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`
|
||||||
|
(there's the dimension-agnostic `QuantityPoint`),
|
@@ -30,8 +30,7 @@ namespace units {
|
|||||||
/**
|
/**
|
||||||
* @brief A quantity point
|
* @brief A quantity point
|
||||||
*
|
*
|
||||||
* Property of a phenomenon, body, or substance, where the property has a magnitude that can be
|
* An absolute quantity with respect to zero (which represents some origin).
|
||||||
* expressed by means of a number and a measurement unit.
|
|
||||||
*
|
*
|
||||||
* @tparam D a dimension of the quantity point (can be either a BaseDimension or a DerivedDimension)
|
* @tparam D a dimension of the quantity point (can be either a BaseDimension or a DerivedDimension)
|
||||||
* @tparam U a measurement unit of the quantity point
|
* @tparam U a measurement unit of the quantity point
|
||||||
|
Reference in New Issue
Block a user