[#mp_units-derived_quantity_spec] = xref:mp_units.adoc[mp_units]::derived_quantity_spec :relfileprefix: ../ :mrdocs: A specification of a derived quantity == Synopsis Declared in `<mp‐units/framework/quantity_spec.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template</* implementation-defined */... Expr> struct derived_quantity_spec final : /* implementation-defined */ ---- == Base Classes [cols=2] |=== | Name | Description | `/* implementation-defined */` | |=== == Description Derived quantity is a quantity, in a system of quantities, defined in terms of other quantities of that system. Its dimension is an expression of the dependence of a quantity on the base quantities of a system of quantities as a product of powers of factors corresponding to the base quantities, omitting any numerical factors. Instead of using a raw list of exponents this library decided to use symbolic expression syntax to make types more digestable for the user both for quantity specification and its dimension. The positive exponents are ordered first and all negative exponents are put as a list into the `per<...>` class template. If a power of exponent is different than `1` the quantity type is enclosed in `power<Q, Num, Den>` class template. Otherwise, it is just put directly in the list without any wrapper. In case all of the exponents are negative than the `dimensionless`/`dimension_one` is put in the front to increase the readability. The character of those quantities is derived from ingredients or overriden with a template parameter. For example: [,cpp] ---- {.cpp} auto frequency = inverse(period_duration); auto area = pow<2>(length); auto speed = distance / duration; auto velocity = displacement / duration; auto acceleration = velocity / duration; ---- ‐ the type of `frequency` is `derived_quantity_spec<dimensionless, per<period_duration>>` ‐ the dimension type of `frequency` is `derived_dimension<dimension_one, per<dim_time>>` ‐ the type of `area` is `derived_quantity_spec<power<length, 2>>` ‐ the dimension type of `area` is `derived_dimension<power<dim_length, 2>>` ‐ the type of `speed` is `derived_quantity_spec<distance, per<duration>>` ‐ the dimension type of `speed` is `derived_dimension<dim_length, per<dim_time>>` ‐ the type of `velocity` is `derived_quantity_spec<displacement, per<duration>>` ‐ the dimension type of `velocity` is `derived_dimension<dim_length, per<dim_time>>` ‐ the type of `acceleration` is `derived_quantity_spec<velocity, per<duration>>` ‐ the dimension type of `acceleration` is `derived_dimension<dim_length, per<power<dim_time, 2>>>` [NOTE] ==== User should not instantiate this type! It is not exported from the C++ module. The library will instantiate this type automatically based on the dimensional arithmetic equation provided by the user. ==== == Template Parameters [cols=2] |=== | Name | Description | *Expr* | a parameter pack consisting tokens allowed in the quantity specification (named quantity specification, `dimensionless`, `power<Q, Num, Den>`, `per<...>`) |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#