forked from mpusz/mp-units
144 lines
38 KiB
HTML
144 lines
38 KiB
HTML
<!DOCTYPE html><html lang='en'><head><title>[qties]</title><meta charset='UTF-8'/><link rel='stylesheet' type='text/css' href='14882.css'/><link rel='stylesheet' type='text/css' href='https://fonts.googleapis.com/css2?family=Noto+Serif'/><link rel='stylesheet' type='text/css' href='https://fonts.googleapis.com/css2?family=Noto+Sans'/><link rel='stylesheet' type='text/css' href='https://fonts.googleapis.com/css2?family=Noto+Sans+Mono'/><link rel='icon' href='icon.png'/><link rel='stylesheet' type='text/css' href='expanded.css' title='Normal'/><link rel='alternate stylesheet' type='text/css' href='colored.css' title='Notes and examples colored'/><link rel='alternate stylesheet' type='text/css' href='normative-only.css' title='Notes and examples hidden'/></head><body><div class='wrapper'><h1 ><a class='secnum' style='min-width:50pt'>5</a> Quantities library <a class='abbr_ref' href='index.html#qties'>[qties]</a></h1><div id='summary' class='section'><h2 ><a class='secnum' href='#summary' style='min-width:65pt'>5.1</a> Summary <a class='abbr_ref' href='qties.summary.html'>[qties.summary]</a></h2><div class='para' id='summary-1'><div class='marginalizedparent'><a class='marginalized' href='#summary-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units315e47c2573226a4fea735c0514806595d94ed6d/source/quantities.tex#L6'>#</a></div><div class='texpara'><div id='summary-1.sentence-1' class='sentence'>This Clause describes components for dealing with quantities,
|
|
as summarized in Table <a href='#tab:qties.summary' title='Table 3: Quantities library summary'>3</a><a class='hidden_link' href='#summary-1.sentence-1'>.</a></div></div><div class='texpara'><div class='numberedTable' id='tab:qties.summary'>Table <a href='#tab:qties.summary'>3</a>: Quantities library summary <a href='./tab:qties.summary.html'>[tab:qties.summary]</a><br><table ><tr id='tab:qties.summary-row-1' class='rowsep'><td class='hidden'><div class='marginalizedparent'><a class='itemDeclLink' href='#tab:qties.summary-row-1'>🔗</a></div></td><td class='empty left'></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-1-column-2-sentence-1' class='sentence'><b>Subclause</b></div></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-1-column-3-sentence-1' class='sentence'><b>Module</b></div></div></td></tr><tr id='tab:qties.summary-row-2' class='capsep'><td class='hidden'><div class='marginalizedparent'><a class='itemDeclLink' href='#tab:qties.summary-row-2'>🔗</a></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-2-column-1-sentence-1' class='sentence'><a href='#qty.helpers' title='5.5 Helpers'>[qty.<span class='shy'></span>helpers]</a></div></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-2-column-2-sentence-1' class='sentence'>Helpers</div></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-2-column-3-sentence-1' class='sentence'><span class='texttt'>mp_<span class='shy'></span>units<span class='operator'>.</span>core</span></div></div></td></tr><tr id='tab:qties.summary-row-3'><td class='hidden'><div class='marginalizedparent'><a class='itemDeclLink' href='#tab:qties.summary-row-3'>🔗</a></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-3-column-1-sentence-1' class='sentence'><a href='#qty.traits' title='5.6 Traits'>[qty.<span class='shy'></span>traits]</a></div></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-3-column-2-sentence-1' class='sentence'>Traits</div></div></td><td class='empty left'></td></tr><tr id='tab:qties.summary-row-4'><td class='hidden'><div class='marginalizedparent'><a class='itemDeclLink' href='#tab:qties.summary-row-4'>🔗</a></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-4-column-1-sentence-1' class='sentence'><a href='#qty.concepts' title='5.7 Concepts'>[qty.<span class='shy'></span>concepts]</a></div></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-4-column-2-sentence-1' class='sentence'>Concepts</div></div></td><td class='empty left'></td></tr><tr id='tab:qties.summary-row-5'><td class='hidden'><div class='marginalizedparent'><a class='itemDeclLink' href='#tab:qties.summary-row-5'>🔗</a></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-5-column-1-sentence-1' class='sentence'><a href='#qty.types' title='5.8 Types'>[qty.<span class='shy'></span>types]</a></div></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-5-column-2-sentence-1' class='sentence'>Types</div></div></td><td class='empty left'></td></tr><tr id='tab:qties.summary-row-6'><td class='hidden'><div class='marginalizedparent'><a class='itemDeclLink' href='#tab:qties.summary-row-6'>🔗</a></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-6-column-1-sentence-1' class='sentence'><a href='#qty.compat' title='5.9 Compatibility'>[qty.<span class='shy'></span>compat]</a></div></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-6-column-2-sentence-1' class='sentence'>Compatibility</div></div></td><td class='empty left'></td></tr><tr id='tab:qties.summary-row-7'><td class='hidden'><div class='marginalizedparent'><a class='itemDeclLink' href='#tab:qties.summary-row-7'>🔗</a></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-7-column-1-sentence-1' class='sentence'><a href='#qty.one' title='5.10 Dimension one'>[qty.<span class='shy'></span>one]</a></div></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-7-column-2-sentence-1' class='sentence'>Dimension one</div></div></td><td class='empty left'></td></tr><tr id='tab:qties.summary-row-8' class='rowsep'><td class='hidden'><div class='marginalizedparent'><a class='itemDeclLink' href='#tab:qties.summary-row-8'>🔗</a></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-8-column-1-sentence-1' class='sentence'><a href='#qty.systems' title='5.11 Systems'>[qty.<span class='shy'></span>systems]</a></div></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-8-column-2-sentence-1' class='sentence'>Systems</div></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-8-column-3-sentence-1' class='sentence'><span class='texttt'>mp_<span class='shy'></span>units<span class='operator'>.</span>systems</span></div></div></td></tr><tr id='tab:qties.summary-row-9'><td class='hidden'><div class='marginalizedparent'><a class='itemDeclLink' href='#tab:qties.summary-row-9'>🔗</a></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-9-column-1-sentence-1' class='sentence'><a href='#qty.chrono' title='5.12 std​::​chrono compatibility'>[qty.<span class='shy'></span>chrono]</a></div></div></td><td class='left'><div class='texpara'><div id='tab:qties.summary-row-9-column-2-sentence-1' class='sentence'><span class='texttt'>std<span class='operator'>​::​</span>chrono</span> compatibility</div></div></td><td class='empty left'></td></tr></table></div></div></div></div><div id='mp.units.syn' class='section'><h2 ><a class='secnum' href='#mp.units.syn' style='min-width:65pt'>5.2</a> Module <span class='texttt'>mp_<span class='shy'></span>units</span> synopsis <a class='abbr_ref' href='mp.units.syn.html'>[mp.units.syn]</a></h2><div class='texpara'><span id='module:mp_units'><div class='marginalizedparent'><a class='itemDeclLink' href='#module:mp_units'>🔗</a></div><span class='codeblock'><span class='keyword'>export</span> <span class='keyword'>module</span> mp_units;
|
|
|
|
<span class='keyword'>export</span> <span class='keyword'>import</span> mp_units<span class='operator'>.</span>core;
|
|
<span class='keyword'>export</span> <span class='keyword'>import</span> mp_units<span class='operator'>.</span>systems;
|
|
</span></span></div></div><div id='mp.units.core.syn' class='section'><h2 ><a class='secnum' href='#mp.units.core.syn' style='min-width:65pt'>5.3</a> Module <span class='texttt'>mp_<span class='shy'></span>units.core</span> synopsis <a class='abbr_ref' href='mp.units.core.syn.html'>[mp.units.core.syn]</a></h2><div class='texpara'><span id='module:mp_units.core'><div class='marginalizedparent'><a class='itemDeclLink' href='#module:mp_units.core'>🔗</a></div><span class='codeblock'><span class='keyword'>export</span> <span class='keyword'>module</span> mp_units<span class='operator'>.</span>core;
|
|
|
|
<span class='keyword'>import</span> std;
|
|
|
|
<span class='keyword'>export</span> <span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
|
|
|
<span class='keyword'>export</span> <span class='keyword'>enum</span> <span class='keyword'>class</span> quantity_character <span class='curlybracket'>{</span> scalar, vector, tensor <span class='curlybracket'>}</span>;
|
|
|
|
<span class='comment'>// <a href='#qty.traits' title='5.6 Traits'>[qty.<span class='shy'></span>traits]</a>, traits</span>
|
|
|
|
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Rep<span class='anglebracket'>></span>
|
|
<span class='keyword'>constexpr</span> <span class='keyword'>bool</span> treat_as_floating_point <span class='operator'>=</span> std<span class='operator'>::</span>is_floating_point_v<span class='anglebracket'><</span>Rep<span class='anglebracket'>></span>;
|
|
|
|
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Rep<span class='anglebracket'>></span>
|
|
<span class='keyword'>constexpr</span> <span class='keyword'>bool</span> is_scalar <span class='operator'>=</span>
|
|
std<span class='operator'>::</span>is_floating_point_v<span class='anglebracket'><</span>Rep<span class='anglebracket'>></span> <span class='operator'>|</span><span class='operator'>|</span> <span class='parenthesis'>(</span>std<span class='operator'>::</span>is_integral_v<span class='anglebracket'><</span>Rep<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <span class='operator'>!</span>is_same_v<span class='anglebracket'><</span>Rep, <span class='keyword'>bool</span><span class='anglebracket'>></span><span class='parenthesis'>)</span>;
|
|
|
|
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Rep<span class='anglebracket'>></span>
|
|
<span class='keyword'>constexpr</span> <span class='keyword'>bool</span> is_vector <span class='operator'>=</span> <span class='literal'>false</span>;
|
|
|
|
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Rep<span class='anglebracket'>></span>
|
|
<span class='keyword'>constexpr</span> <span class='keyword'>bool</span> is_tensor <span class='operator'>=</span> <span class='literal'>false</span>;
|
|
|
|
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Rep<span class='anglebracket'>></span>
|
|
<span class='keyword'>struct</span> quantity_values;
|
|
|
|
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> T<span class='anglebracket'>></span>
|
|
<span class='keyword'>struct</span> quantity_like_traits;
|
|
|
|
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> T<span class='anglebracket'>></span>
|
|
<span class='keyword'>struct</span> quantity_point_like_traits;
|
|
|
|
<span class='comment'>// <a href='#qty.concepts' title='5.7 Concepts'>[qty.<span class='shy'></span>concepts]</a>, concepts</span>
|
|
|
|
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> T<span class='anglebracket'>></span>
|
|
<span class='keyword'>concept</span> <a class='hidden_link' href='#concept:some_reference' title='5.3 Module mp_­units.core synopsis [mp.units.core.syn]'><span id='concept:some_reference'><span id='lib:some_reference'><span class='tcode_in_codeblock'>some_<span class='shy'></span>reference</span></span></span></a> <span class='operator'>=</span> template_of<span class='parenthesis'>(</span><span class='operator'>^</span>std<span class='operator'>::</span>remove_cvref_t<span class='anglebracket'><</span>T<span class='anglebracket'>></span><span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> <span class='operator'>^</span>reference;
|
|
|
|
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> T<span class='anglebracket'>></span>
|
|
<span class='keyword'>concept</span> representation <span class='operator'>=</span> <i ><span class='texttt'>see below</span></i>;
|
|
|
|
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> T, quantity_character Ch<span class='anglebracket'>></span>
|
|
<span class='keyword'>concept</span> representation_of <span class='operator'>=</span> <i ><span class='texttt'>see below</span></i>;
|
|
|
|
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> T<span class='anglebracket'>></span>
|
|
<span class='keyword'>concept</span> some_quantity_spec <span class='operator'>=</span> <i ><span class='texttt'>see below</span></i>;
|
|
|
|
<span class='comment'>// <a href='#qty.types' title='5.8 Types'>[qty.<span class='shy'></span>types]</a>, types</span>
|
|
|
|
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>auto</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>></span>
|
|
<span class='keyword'>struct</span> quantity_spec; <span class='comment'>// <i >not defined</i></span>
|
|
|
|
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>auto</span> Q<span class='anglebracket'>></span>
|
|
<span class='keyword'>struct</span> kind_of_; <span class='comment'>// <i >not defined</i></span>
|
|
|
|
<span class='keyword'>template</span><span class='anglebracket'><</span><i ><span class='texttt'>unspecified</span></i><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> Expr<span class='anglebracket'>></span>
|
|
<span class='keyword'>struct</span> derived_quantity_spec;
|
|
|
|
<span class='comment'>// <a href='#qty.type' title='5.8.2 Class template quantity'>[qty.<span class='shy'></span>type]</a>, class template <span class='tcode_in_codeblock'>quantity</span></span>
|
|
<span class='keyword'>export</span> <span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:some_reference' title='5.3 Module mp_­units.core synopsis [mp.units.core.syn]'><span id='conceptref:some_reference'><span class='tcode_in_codeblock'>some_<span class='shy'></span>reference</span></span></a> <span class='keyword'>auto</span> R,
|
|
<a href='#concept:representation_of' title='5.7 Concepts [qty.concepts]'><span id='conceptref:representation_of'><span class='tcode_in_codeblock'>representation_<span class='shy'></span>of</span></span></a><span class='anglebracket'><</span>get_quantity_spec<span class='parenthesis'>(</span>R<span class='parenthesis'>)</span><span class='operator'>.</span>character<span class='anglebracket'>></span> Rep <span class='operator'>=</span> <span class='keyword'>double</span><span class='anglebracket'>></span>
|
|
<span class='keyword'>class</span> quantity;
|
|
|
|
<span class='comment'>// <a href='#qty.point.type' title='5.8.3 Class template quantity_­point'>[qty.<span class='shy'></span>point.<span class='shy'></span>type]</a>, class template <span class='tcode_in_codeblock'>quantity_<span class='shy'></span>point</span></span>
|
|
<span class='keyword'>template</span><span class='anglebracket'><</span><i ><span class='texttt'>unspecified</span></i><span class='anglebracket'>></span>
|
|
<span class='keyword'>class</span> quantity_point;
|
|
|
|
<span class='curlybracket'>}</span>
|
|
</span></span></div></div><div id='mp.units.systems.syn' class='section'><h2 ><a class='secnum' href='#mp.units.systems.syn' style='min-width:65pt'>5.4</a> Module <span class='texttt'>mp_<span class='shy'></span>units.systems</span> synopsis <a class='abbr_ref' href='mp.units.systems.syn.html'>[mp.units.systems.syn]</a></h2><div class='texpara'><span id='module:mp_units.systems'><div class='marginalizedparent'><a class='itemDeclLink' href='#module:mp_units.systems'>🔗</a></div><span class='codeblock'><span class='keyword'>export</span> <span class='keyword'>module</span> mp_units<span class='operator'>.</span>systems;
|
|
|
|
<span class='keyword'>export</span> <span class='keyword'>import</span> mp_units<span class='operator'>.</span>core;
|
|
<span class='keyword'>import</span> std;
|
|
|
|
<span class='keyword'>export</span> <span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
|
|
|
<span class='curlybracket'>}</span>
|
|
</span></span></div></div><div id='qty.helpers' class='section'><h2 ><a class='secnum' href='#qty.helpers' style='min-width:65pt'>5.5</a> Helpers <a class='abbr_ref' href='qty.helpers.html'>[qty.helpers]</a></h2><div class='texpara'><div class='itemdecl' id='qty.helpers-itemdecl:1'><div class='marginalizedparent'><a class='itemDeclLink' href='#qty.helpers-itemdecl:1'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <span class='keyword'>bool</span> <span class='texttt'><i >converts-to-base-subobject-of</i></span><span class='parenthesis'>(</span>std<span class='operator'>::</span>meta type, std<span class='operator'>::</span>meta template_name<span class='parenthesis'>)</span>;
|
|
</code></div></div><div class='para' id='qty.helpers-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.helpers-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units315e47c2573226a4fea735c0514806595d94ed6d/source/quantities.tex#L122'>#</a></div><div class='texpara'><div id='qty.helpers-1.sentence-1' class='sentence'><i >Preconditions</i>: <span class='texttt'>is_<span class='shy'></span>type<span class='parenthesis'>(</span>type<span class='parenthesis'>)</span> <span class='operator'>&</span><span class='operator'>&</span> is_<span class='shy'></span>template<span class='parenthesis'>(</span>template_<span class='shy'></span>name<span class='parenthesis'>)</span></span> is <span class='texttt'><span class='literal'>true</span></span><a class='hidden_link' href='#qty.helpers-1.sentence-1'>.</a></div></div></div></div><div class='para' id='qty.helpers-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.helpers-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units315e47c2573226a4fea735c0514806595d94ed6d/source/quantities.tex#L126'>#</a></div><div class='texpara'><div id='qty.helpers-2.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'><span class='literal'>true</span></span> if
|
|
<span class='texttt'><span class='squarebracket'>[</span><span class='operator'>:</span>type<span class='operator'>:</span><span class='squarebracket'>]</span></span> has an unambiguous and accessible base
|
|
that is a specialization of <span class='texttt'><span class='squarebracket'>[</span><span class='operator'>:</span>template_<span class='shy'></span>name<span class='operator'>:</span><span class='squarebracket'>]</span></span>, and
|
|
<span class='texttt'><span class='literal'>false</span></span> otherwise<a class='hidden_link' href='#qty.helpers-2.sentence-1'>.</a></div></div></div></div></div><div id='qty.traits' class='section'><h2 ><a class='secnum' href='#qty.traits' style='min-width:65pt'>5.6</a> Traits <a class='abbr_ref' href='qty.traits.html'>[qty.traits]</a></h2><div class='texpara'><div class='itemdecl' id='qty.traits-itemdecl:1'><div class='marginalizedparent'><a class='itemDeclLink' href='#qty.traits-itemdecl:1'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Rep<span class='anglebracket'>></span>
|
|
<span class='keyword'>constexpr</span> <span class='keyword'>bool</span> <span id='lib:is_scalar'><a class='hidden_link' href='#lib:is_scalar' title='5.6 Traits [qty.traits]'>is_scalar</a></span> <span class='operator'>=</span>
|
|
std<span class='operator'>::</span>is_floating_point_v<span class='anglebracket'><</span>Rep<span class='anglebracket'>></span> <span class='operator'>|</span><span class='operator'>|</span> <span class='parenthesis'>(</span>std<span class='operator'>::</span>is_integral_v<span class='anglebracket'><</span>Rep<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <span class='operator'>!</span>is_same_v<span class='anglebracket'><</span>Rep, <span class='keyword'>bool</span><span class='anglebracket'>></span><span class='parenthesis'>)</span>;
|
|
|
|
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Rep<span class='anglebracket'>></span>
|
|
<span class='keyword'>constexpr</span> <span class='keyword'>bool</span> <span id='lib:is_vector'><a class='hidden_link' href='#lib:is_vector' title='5.6 Traits [qty.traits]'>is_vector</a></span> <span class='operator'>=</span> <span class='literal'>false</span>;
|
|
|
|
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Rep<span class='anglebracket'>></span>
|
|
<span class='keyword'>constexpr</span> <span class='keyword'>bool</span> <span id='lib:is_tensor'><a class='hidden_link' href='#lib:is_tensor' title='5.6 Traits [qty.traits]'>is_tensor</a></span> <span class='operator'>=</span> <span class='literal'>false</span>;
|
|
</code></div></div><div class='para' id='qty.traits-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.traits-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units315e47c2573226a4fea735c0514806595d94ed6d/source/quantities.tex#L149'>#</a></div><div class='texpara'><div id='qty.traits-1.sentence-1' class='sentence'><i >Remarks</i>: Pursuant to <a href="https://wg21.link/namespace.std">N4971, [namespace.std]</a> (<a href='spec.ext.html' title='4.1 External'>[spec.<span class='shy'></span>ext]</a>),
|
|
users may specialize <span class='texttt'>is_<span class='shy'></span>scalar</span>, <span class='texttt'>is_<span class='shy'></span>vector</span>, and <span class='texttt'>is_<span class='shy'></span>tensor</span> to <span class='texttt'><span class='literal'>true</span></span>
|
|
for cv-unqualified program-defined types
|
|
which respectively represent
|
|
a scalar (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=102-02-18">IEC 60050, 102-02-18</a>),
|
|
a vector (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=102-03-04">IEC 60050, 102-03-04</a>), and
|
|
a tensor,
|
|
and <span class='texttt'><span class='literal'>false</span></span> for types which respectively do not<a class='hidden_link' href='#qty.traits-1.sentence-1'>.</a></div></div></div></div></div><div id='qty.concepts' class='section'><h2 ><a class='secnum' href='#qty.concepts' style='min-width:65pt'>5.7</a> Concepts <a class='abbr_ref' href='qty.concepts.html'>[qty.concepts]</a></h2><div class='texpara'><div class='itemdecl' id='concept:representation'><div class='marginalizedparent'><a class='itemDeclLink' href='#concept:representation'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>export</span> <span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> T<span class='anglebracket'>></span>
|
|
<span class='keyword'>concept</span> <a class='hidden_link' href='#concept:representation' title='5.7 Concepts [qty.concepts]'><span id='concept:representation'><span id='lib:representation'><span class='texttt'>representation</span></span></span></a> <span class='operator'>=</span>
|
|
<span class='parenthesis'>(</span>is_scalar<span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>|</span><span class='operator'>|</span> is_vector<span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>|</span><span class='operator'>|</span> is_tensor<span class='anglebracket'><</span>T<span class='anglebracket'>></span><span class='parenthesis'>)</span><span class='operator'>&</span><span class='operator'>&</span>std<span class='operator'>::</span>regular<span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <span class='texttt'><i >scalable</i></span><span class='anglebracket'><</span>T<span class='anglebracket'>></span>;
|
|
</code></div></div><div class='texpara'><div class='itemdecl' id='concept:representation_of'><div class='marginalizedparent'><a class='itemDeclLink' href='#concept:representation_of'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>export</span> <span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> T, quantity_character Ch<span class='anglebracket'>></span>
|
|
<span class='keyword'>concept</span> <a class='hidden_link' href='#concept:representation_of' title='5.7 Concepts [qty.concepts]'><span id='concept:representation_of'><span id='lib:representation_of'><span class='texttt'>representation_<span class='shy'></span>of</span></span></span></a> <span class='operator'>=</span>
|
|
<a href='#concept:representation' title='5.7 Concepts [qty.concepts]'><span id='conceptref:representation'><span class='texttt'>representation</span></span></a><span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <span class='parenthesis'>(</span><span class='parenthesis'>(</span>Ch <span class='operator'>=</span><span class='operator'>=</span> quantity_character<span class='operator'>::</span>scalar <span class='operator'>&</span><span class='operator'>&</span> is_scalar<span class='anglebracket'><</span>T<span class='anglebracket'>></span><span class='parenthesis'>)</span> <span class='operator'>|</span><span class='operator'>|</span>
|
|
<span class='parenthesis'>(</span>Ch <span class='operator'>=</span><span class='operator'>=</span> quantity_character<span class='operator'>::</span>vector <span class='operator'>&</span><span class='operator'>&</span> is_vector<span class='anglebracket'><</span>T<span class='anglebracket'>></span><span class='parenthesis'>)</span> <span class='operator'>|</span><span class='operator'>|</span>
|
|
<span class='parenthesis'>(</span>Ch <span class='operator'>=</span><span class='operator'>=</span> quantity_character<span class='operator'>::</span>tensor <span class='operator'>&</span><span class='operator'>&</span> is_tensor<span class='anglebracket'><</span>T<span class='anglebracket'>></span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>;
|
|
</code></div></div><div class='texpara'><div class='itemdecl' id='qty.concepts-itemdecl:3'><div class='marginalizedparent'><a class='itemDeclLink' href='#qty.concepts-itemdecl:3'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> T<span class='anglebracket'>></span>
|
|
<span class='keyword'>concept</span> <span class='texttt'><i >named-quantity-spec</i></span><a class='index' id='concept:named-quantity-spec'></a> <span class='operator'>=</span>
|
|
<span class='parenthesis'>(</span><span class='texttt'><i >converts-to-base-subobject-of</i></span><span class='parenthesis'>(</span><span class='operator'>^</span>T, <span class='operator'>^</span>quantity_spec<span class='parenthesis'>)</span> <span class='operator'>&</span><span class='operator'>&</span> template_of<span class='parenthesis'>(</span><span class='operator'>^</span>T<span class='parenthesis'>)</span> <span class='operator'>!</span><span class='operator'>=</span> <span class='operator'>^</span>kind_of_<span class='parenthesis'>)</span>;
|
|
|
|
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> T<span class='anglebracket'>></span>
|
|
<span class='keyword'>concept</span> <a class='hidden_link' href='#concept:some_quantity_spec' title='5.7 Concepts [qty.concepts]'><span id='concept:some_quantity_spec'><span id='lib:some_quantity_spec'><span class='texttt'>some_<span class='shy'></span>quantity_<span class='shy'></span>spec</span></span></span></a> <span class='operator'>=</span>
|
|
<a class='index' id='conceptref:named-quantity-spec'></a><span class='texttt'><i >named-quantity-spec</i></span><span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>|</span><span class='operator'>|</span>
|
|
detail<span class='operator'>::</span>IntermediateDerivedQuantitySpec<span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>|</span><span class='operator'>|</span>
|
|
template_of<span class='parenthesis'>(</span><span class='operator'>^</span>T<span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> <span class='operator'>^</span>kind_of;
|
|
</code></div></div></div><div id='qty.types' class='section'><h2 ><a class='secnum' href='#qty.types' style='min-width:65pt'>5.8</a> Types <a class='abbr_ref' href='qty.types.html'>[qty.types]</a></h2><div id='qty.types.general' class='section'><h3 ><a class='secnum' href='#qty.types.general' style='min-width:80pt'>5.8.1</a> General <a class='abbr_ref' href='qty.types.general.html'>[qty.types.general]</a></h3><div class='para' id='qty.types.general-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.types.general-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units315e47c2573226a4fea735c0514806595d94ed6d/source/quantities.tex#L196'>#</a></div><div class='texpara'><div id='qty.types.general-1.sentence-1' class='sentence'>A <a class='hidden_link' href='#def:type,quantity' title='5.8.1 General [qty.types.general]'><span id='def:type,quantity'><i >quantity type</i></span></a>
|
|
is a type <span class='texttt'><i >Q</i></span>
|
|
that is a specialization of <span class='texttt'>quantity</span> or <span class='texttt'>quantity_<span class='shy'></span>point</span><a class='hidden_link' href='#qty.types.general-1.sentence-1'>.</a></div> <div id='qty.types.general-1.sentence-2' class='sentence'><span class='texttt'><i >Q</i></span> represents a quantity (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-01">IEC 60050, 112-01-01</a>)
|
|
with <span class='texttt'><i >Q</i><span class='operator'>​::​</span>rep</span> as its number
|
|
and <span class='texttt'><i >Q</i><span class='operator'>​::​</span>reference</span> as its reference<a class='hidden_link' href='#qty.types.general-1.sentence-2'>.</a></div> <div id='qty.types.general-1.sentence-3' class='sentence'><span class='texttt'><i >Q</i></span> is a structural type (<a href="https://wg21.link/temp.paramterm.structural.type">N4971, [temp.param]</a>)
|
|
if <span class='texttt'><i >Q</i><span class='operator'>​::​</span>rep</span> is a structural type<a class='hidden_link' href='#qty.types.general-1.sentence-3'>.</a></div></div></div><div class='para' id='qty.types.general-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.types.general-2'>2</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units315e47c2573226a4fea735c0514806595d94ed6d/source/quantities.tex#L206'>#</a></div><div class='texpara'><div id='qty.types.general-2.sentence-1' class='sentence'>Each class template defined in subclause <a href='#qty.types' title='5.8 Types'>[qty.<span class='shy'></span>types]</a>
|
|
has data members and special members specified below, and
|
|
has no base classes or members other than those specified<a class='hidden_link' href='#qty.types.general-2.sentence-1'>.</a></div></div></div></div><div id='qty.type' class='section'><h3 ><a class='secnum' href='#qty.type' style='min-width:80pt'>5.8.2</a> Class template <span class='texttt'>quantity</span> <a class='abbr_ref' href='qty.type.html'>[qty.type]</a></h3><div class='texpara'><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
|
|
|
<span class='keyword'>export</span> <span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:some_reference' title='5.3 Module mp_­units.core synopsis [mp.units.core.syn]'><span id='conceptref:some_reference_'><span class='tcode_in_codeblock'>some_<span class='shy'></span>reference</span></span></a> <span class='keyword'>auto</span> R,
|
|
<a href='#concept:representation_of' title='5.7 Concepts [qty.concepts]'><span id='conceptref:representation_of_'><span class='tcode_in_codeblock'>representation_<span class='shy'></span>of</span></span></a><span class='anglebracket'><</span>get_quantity_spec<span class='parenthesis'>(</span>R<span class='parenthesis'>)</span><span class='operator'>.</span>character<span class='anglebracket'>></span> Rep <span class='operator'>=</span> <span class='keyword'>double</span><span class='anglebracket'>></span>
|
|
<span class='keyword'>class</span> quantity <span class='curlybracket'>{</span> <i ><span class='texttt'>unspecified</span></i> <span class='curlybracket'>}</span>;
|
|
|
|
<span class='curlybracket'>}</span>
|
|
</span></div><div class='texpara'><div id='qty.type-sentence-1' class='sentence'>Let <span class='texttt'><i >Q</i></span> be a specialization of <span class='texttt'>quantity</span><a class='hidden_link' href='#qty.type-sentence-1'>.</a></div> <ul class='itemize'><li ><div class='texpara'><div id='qty.type-sentence-1' class='sentence'>If <span class='texttt'>Rep</span> is a scalar,
|
|
<span class='texttt'><i >Q</i></span> represents a scalar quantity (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=102-02-19">IEC 60050, 102-02-19</a>)<a class='hidden_link' href='#qty.type-sentence-1'>.</a></div></div></li><li ><div class='texpara'><div id='qty.type-sentence-1' class='sentence'>If <span class='texttt'>Rep</span> is a vector,
|
|
<span class='texttt'><i >Q</i></span> represents a vector (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=102-03-04">IEC 60050, 102-03-04</a>)<a class='hidden_link' href='#qty.type-sentence-1'>.</a></div></div></li></ul></div></div><div id='qty.point.type' class='section'><h3 ><a class='secnum' href='#qty.point.type' style='min-width:80pt'>5.8.3</a> Class template <span class='texttt'>quantity_<span class='shy'></span>point</span> <a class='abbr_ref' href='qty.point.type.html'>[qty.point.type]</a></h3><div class='texpara'><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
|
|
|
<span class='keyword'>export</span> <span class='keyword'>template</span><span class='anglebracket'><</span><i ><span class='texttt'>unspecified</span></i><span class='anglebracket'>></span>
|
|
<span class='keyword'>class</span> quantity_point <span class='curlybracket'>{</span> <i ><span class='texttt'>unspecified</span></i> <span class='curlybracket'>}</span>;
|
|
|
|
<span class='curlybracket'>}</span>
|
|
</span></div><div class='texpara'><div id='qty.point.type-sentence-1' class='sentence'>A <a class='hidden_link' href='#def:type,quantity_point' title='5.8.3 Class template quantity_­point [qty.point.type]'><span id='def:type,quantity_point'><i >quantity point type</i></span></a> is a specialization of <span class='texttt'>quantity_<span class='shy'></span>point</span><a class='hidden_link' href='#qty.point.type-sentence-1'>.</a></div> <div id='qty.point.type-sentence-2' class='sentence'>Let <span class='texttt'><i >Q</i></span> be a quantity point type<a class='hidden_link' href='#qty.point.type-sentence-2'>.</a></div> <div id='qty.point.type-sentence-3' class='sentence'><span class='texttt'><i >Q</i><span class='operator'>​::​</span>point_<span class='shy'></span>origin</span> represents
|
|
the origin point of a position vector (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=102-03-15">IEC 60050, 102-03-15</a>)<a class='hidden_link' href='#qty.point.type-sentence-3'>.</a></div> <ul class='itemize'><li ><div class='texpara'><div id='qty.point.type-sentence-1' class='sentence'>If <span class='texttt'>Rep</span> is a scalar,
|
|
<span class='texttt'><i >Q</i></span> represents the scalar quantity (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=102-02-19">IEC 60050, 102-02-19</a>)
|
|
of a position vector<a class='hidden_link' href='#qty.point.type-sentence-1'>.</a></div></div></li><li ><div class='texpara'><div id='qty.point.type-sentence-1' class='sentence'>If <span class='texttt'>Rep</span> is a vector,
|
|
<span class='texttt'><i >Q</i></span> represents a position vector<a class='hidden_link' href='#qty.point.type-sentence-1'>.</a></div></div></li></ul></div></div></div><div id='qty.compat' class='section'><h2 ><a class='secnum' href='#qty.compat' style='min-width:65pt'>5.9</a> Compatibility <a class='abbr_ref' href='qty.compat.html'>[qty.compat]</a></h2></div><div id='qty.one' class='section'><h2 ><a class='secnum' href='#qty.one' style='min-width:65pt'>5.10</a> Dimension one <a class='abbr_ref' href='qty.one.html'>[qty.one]</a></h2></div><div id='qty.systems' class='section'><h2 ><a class='secnum' href='#qty.systems' style='min-width:65pt'>5.11</a> Systems <a class='abbr_ref' href='qty.systems.html'>[qty.systems]</a></h2></div><div id='qty.chrono' class='section'><h2 ><a class='secnum' href='#qty.chrono' style='min-width:65pt'>5.12</a> <span class='texttt'>std​::​chrono</span> compatibility <a class='abbr_ref' href='qty.chrono.html'>[qty.chrono]</a></h2></div></div></body></html> |