[#mp_units-derived_quantity_spec]
= xref:mp_units.adoc[mp&lowbar;units]::derived&lowbar;quantity&lowbar;spec
:relfileprefix: ../
:mrdocs:

A specification of a derived quantity

== Synopsis

Declared in `&lt;mp&hyphen;units&sol;framework&sol;quantity&lowbar;spec&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;&sol;&ast; implementation-defined &ast;&sol;&period;&period;&period; Expr&gt;
struct derived&lowbar;quantity&lowbar;spec
    : &sol;&ast; implementation-defined &ast;&sol;
----

== Description

Derived quantity is a quantity, in a system of quantities, defined in terms of other quantities of that system&period; 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&period;

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&period; The positive exponents are ordered first and all negative exponents are put as a list into the `per&lt;&period;&period;&period;&gt;` class template&period; If a power of exponent is different than `1` the quantity type is enclosed in `power&lt;Q, Num, Den&gt;` class template&period; Otherwise, it is just put directly in the list without any wrapper&period; In case all of the exponents are negative than the `dimensionless`&sol;`dimension&lowbar;one` is put in the front to increase the readability&period;

The character of those quantities is derived from ingredients or overriden with a template parameter&period;

For example&colon;

[,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&lowbar;quantity&lowbar;spec&lt;dimensionless, per&lt;period&lowbar;duration&gt;&gt;`
* the dimension type of `frequency` is `derived&lowbar;dimension&lt;dimension&lowbar;one, per&lt;dim&lowbar;time&gt;&gt;`
* the type of `area` is `derived&lowbar;quantity&lowbar;spec&lt;power&lt;length, 2&gt;&gt;`
* the dimension type of `area` is `derived&lowbar;dimension&lt;power&lt;dim&lowbar;length, 2&gt;&gt;`
* the type of `speed` is `derived&lowbar;quantity&lowbar;spec&lt;distance, per&lt;duration&gt;&gt;`
* the dimension type of `speed` is `derived&lowbar;dimension&lt;dim&lowbar;length, per&lt;dim&lowbar;time&gt;&gt;`
* the type of `velocity` is `derived&lowbar;quantity&lowbar;spec&lt;displacement, per&lt;duration&gt;&gt;`
* the dimension type of `velocity` is `derived&lowbar;dimension&lt;dim&lowbar;length, per&lt;dim&lowbar;time&gt;&gt;`
* the type of `acceleration` is `derived&lowbar;quantity&lowbar;spec&lt;velocity, per&lt;duration&gt;&gt;`
* the dimension type of `acceleration` is `derived&lowbar;dimension&lt;dim&lowbar;length, per&lt;power&lt;dim&lowbar;time, 2&gt;&gt;&gt;`

[NOTE]
====
User should not instantiate this type! It is not exported from the C&plus;&plus; module&period; The library will instantiate this type automatically based on the dimensional arithmetic equation provided by the user&period;

====

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `&sol;&ast; implementation-defined &ast;&sol;`
| 
|===

== Type Aliases

[cols="1"]
|===
| Name
| xref:mp_units/derived_quantity_spec/_base_.adoc[`&lowbar;base&lowbar;`] 
| xref:mp_units/derived_quantity_spec/_base_type_.adoc[`&lowbar;base&lowbar;type&lowbar;`] 
|===


== Static Data Members

[cols="1"]
|===
| Name
| xref:mp_units/derived_quantity_spec/_character_.adoc[`&lowbar;character&lowbar;`] 
| xref:mp_units/derived_quantity_spec/_dimension_.adoc[`&lowbar;dimension&lowbar;`] 
| xref:mp_units/derived_quantity_spec/_is_non_negative_.adoc[`&lowbar;is&lowbar;non&lowbar;negative&lowbar;`] 
| xref:mp_units/derived_quantity_spec/character.adoc[`character`]  [.small]#[deprecated]#
| xref:mp_units/derived_quantity_spec/dimension.adoc[`dimension`]  [.small]#[deprecated]#
|===


== Template Parameters

[cols="1,4"]
|===
| Name| Description
| *Expr*
| a parameter pack consisting tokens allowed in the quantity specification (named quantity specification, `dimensionless`, `power&lt;Q, Num, Den&gt;`, `per&lt;&period;&period;&period;&gt;`)
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
