diff --git a/docs/_static/img/units.png b/docs/_static/img/units.png new file mode 100644 index 00000000..311abd6f Binary files /dev/null and b/docs/_static/img/units.png differ diff --git a/docs/framework/units.rst b/docs/framework/units.rst index 714b29bf..a2f10be0 100644 --- a/docs/framework/units.rst +++ b/docs/framework/units.rst @@ -308,6 +308,47 @@ provided in the template parameter list after the derived dimension parameter, the library calculates the final ratio for this unit. +Class hierarchy +--------------- + +All of the above class templates to produce unit types inherit from some instance +of a `scaled_unit` class template: + +.. image:: /_static/img/units.png + :align: center + +.. + http://www.nomnoml.com + + #direction: right + + [scaled_unit]<:-[unit] + [scaled_unit]<:-[named_unit] + [scaled_unit]<:-[named_scaled_unit] + [scaled_unit]<:-[prefixed_unit] + [scaled_unit]<:-[deduced_unit] + +`scaled_unit` is a class template used exclusively by the library's framework +and user should not instantiate it by him/her-self. However the user can sometimes +observe this type in case an unit/dimension conversion expression will end up with an +unknown/undefined unit type like in the below example:: + + using namespace si::literals; + + Length auto l = 100q_km_per_h * 10q_s; + +The type of ``l`` above will be +:expr:`si::length, si::metre>, long double>`. This is caused +by the fact that the library does not define a unit of a length quantity that has the +ratio ``10/36`` of a `si::metre`. If such a unit was predefined we would see its concrete +type here instead. + +.. seealso:: + + To learn more about unknown units please refer to + :ref:`Working with Unknown Units and Dimensions` chapter. + + .. rubric:: Citations: .. [P0847] `"Deducing this" `_, Programming Language C++ proposal