forked from mpusz/mp-units
986 lines
409 KiB
HTML
986 lines
409 KiB
HTML
<!DOCTYPE html><html lang='en'><head><title>[qty.ref]</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 and units library <a class='abbr_ref' href='index.html#quantities'>[quantities]</a></h1><h2 ><a class='secnum' style='min-width:65pt'>5.4</a> Reference <a class='abbr_ref'>[qty.ref]</a></h2><div id='general' class='section'><h3 ><a class='secnum' href='#general' style='min-width:80pt'>5.4.1</a> General <a class='abbr_ref' href='qty.ref.general.html'>[qty.ref.general]</a></h3><div class='para' id='general-1'><div class='marginalizedparent'><a class='marginalized' href='#general-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1336'>#</a></div><div class='texpara'><div id='general-1.sentence-1' class='sentence'>Subclause [qty.<span class='shy'></span>ref] specifies the components
|
||
for describing the reference of a quantity (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-01">IEC 60050, 112-01-01</a>)<a class='hidden_link' href='#general-1.sentence-1'>.</a></div></div></div></div><div id='qty.dim' class='section'><h3 ><a class='secnum' href='#qty.dim' style='min-width:80pt'>5.4.2</a> Dimension <a class='abbr_ref' href='qty.dim.html'>[qty.dim]</a></h3><div id='qty.dim.general' class='section'><h4 ><a class='secnum' href='#qty.dim.general' style='min-width:95pt'>5.4.2.1</a> General <a class='abbr_ref' href='qty.dim.general.html'>[qty.dim.general]</a></h4><div class='para' id='qty.dim.general-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.dim.general-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1344'>#</a></div><div class='texpara'><div id='qty.dim.general-1.sentence-1' class='sentence'>Subclause <a href='#qty.dim' title='5.4.2 Dimension'>[qty.<span class='shy'></span>dim]</a> specifies the components
|
||
for defining the dimension of a quantity (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-11">IEC 60050, 112-01-11</a>)<a class='hidden_link' href='#qty.dim.general-1.sentence-1'>.</a></div></div></div></div><div id='qty.dim.concepts' class='section'><h4 ><a class='secnum' href='#qty.dim.concepts' style='min-width:95pt'>5.4.2.2</a> Concepts <a class='abbr_ref' href='qty.dim.concepts.html'>[qty.dim.concepts]</a></h4><div class='texpara'><div class='itemdecl' id='qty.dim.concepts-itemdecl:1'><div class='marginalizedparent'><a class='itemDeclLink' href='#qty.dim.concepts-itemdecl:1'>🔗</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> <a class='hidden_link' href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='concept:Dimension'><span id='lib:Dimension'><span class='texttt'>Dimension</span></span></span></a> <span class='operator'>=</span> <a class='index' id='conceptref:SymbolicConstant'></a><span class='texttt'><i >SymbolicConstant</i></span><span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> std<span class='operator'>::</span>derived_from<span class='anglebracket'><</span>T, <span class='texttt'><i >dimension-interface</i></span><span class='anglebracket'>></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> <span class='texttt'><i >BaseDimension</i></span><a class='index' id='concept:BaseDimension'></a> <span class='operator'>=</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension'><span class='texttt'>Dimension</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='texttt'><i >is-derived-from-specialization-of</i></span><span class='anglebracket'><</span>T, base_dimension<span class='anglebracket'>></span><span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> T, <span class='keyword'>auto</span> D<span class='anglebracket'>></span>
|
||
<span class='keyword'>concept</span> <a class='hidden_link' href='#concept:DimensionOf' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='concept:DimensionOf'><span id='lib:DimensionOf'><span class='texttt'>DimensionOf</span></span></span></a> <span class='operator'>=</span> <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension_'><span class='texttt'>Dimension</span></span></a><span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension__'><span class='texttt'>Dimension</span></span></a><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>D<span class='parenthesis'>)</span><span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <span class='parenthesis'>(</span>T<span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>=</span><span class='operator'>=</span> D<span class='parenthesis'>)</span>;
|
||
</code></div></div></div><div id='qty.dim.types' class='section'><h4 ><a class='secnum' href='#qty.dim.types' style='min-width:95pt'>5.4.2.3</a> Types <a class='abbr_ref' href='qty.dim.types.html'>[qty.dim.types]</a></h4><div class='texpara'><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span>symbol_text Symbol<span class='anglebracket'>></span>
|
||
<span class='keyword'>struct</span> <span id='lib:base_dimension'><a class='hidden_link' href='#lib:base_dimension' title='5.4.2.3 Types [qty.dim.types]'>base_dimension</a></span> <span class='operator'>:</span> <i >dimension-interface</i> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >symbol</i> <span class='operator'>=</span> Symbol; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></div><div class='para' id='qty.dim.types-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.dim.types-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1375'>#</a></div><div class='texpara'><div id='qty.dim.types-1.sentence-1' class='sentence'><span class='texttt'>base_<span class='shy'></span>dimension</span> is used
|
||
to define the dimension of a base quantity (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-08">IEC 60050, 112-01-08</a>)<a class='hidden_link' href='#qty.dim.types-1.sentence-1'>.</a></div> <div id='qty.dim.types-1.sentence-2' class='sentence'><span class='texttt'>Symbol</span> is its symbolic representation<a class='hidden_link' href='#qty.dim.types-1.sentence-2'>.</a></div> <div id='qty.dim.types-example-1' class='example'><div class='texpara'>[<i>Example <a href='#qty.dim.types-example-1'>1</a></i>: <span class='codeblock'><span class='keyword'>inline</span> <span class='keyword'>constexpr</span> <span class='keyword'>struct</span> dim_length <span class='keyword'>final</span> <span class='operator'>:</span> base_dimension<span class='anglebracket'><</span><span class='literal'>"L"</span><span class='anglebracket'>></span> <span class='curlybracket'>{</span><span class='curlybracket'>}</span> dim_length;
|
||
</span> — <i>end example</i>]</div></div></div><div class='texpara'><span id='lib:derived_dimension'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:derived_dimension'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> Expr<span class='anglebracket'>></span>
|
||
<span class='keyword'>struct</span> <i >derived-dimension-impl</i> <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='operator'>:</span> <i >expr-fractions</i><span class='anglebracket'><</span><span class='keyword'>struct</span> dimension_one, Expr<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>></span> <span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a class='index' id='conceptref:SymbolicConstant_'></a><i >SymbolicConstant</i><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> Expr<span class='anglebracket'>></span>
|
||
<span class='keyword'>struct</span> derived_dimension <span class='keyword'>final</span> <span class='operator'>:</span> <i >dimension-interface</i>, <i >derived-dimension-impl</i><span class='anglebracket'><</span>Expr<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>></span> <span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></div></div><div class='para' id='qty.dim.types-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.dim.types-2'>2</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1399'>#</a></div><div class='texpara'><div id='qty.dim.types-2.sentence-1' class='sentence'><span class='texttt'>derived_<span class='shy'></span>dimension</span> is used by the library
|
||
to represent the dimension of a derived quantity (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-10">IEC 60050, 112-01-10</a>)<a class='hidden_link' href='#qty.dim.types-2.sentence-1'>.</a></div> <div id='qty.dim.types-example-2' class='example'><div class='texpara'>[<i>Example <a href='#qty.dim.types-example-2'>2</a></i>: <span class='codeblock'><span class='keyword'>constexpr</span> <span class='keyword'>auto</span> dim_acceleration <span class='operator'>=</span> isq<span class='operator'>::</span>speed<span class='operator'>.</span>dimension <span class='operator'>/</span> isq<span class='operator'>::</span>dim_time;
|
||
<span class='keyword'>int</span> x <span class='operator'>=</span> dim_acceleration; <span class='comment'>// error: cannot construct from</span>
|
||
<span class='comment'>// <span class='tcode_in_codeblock'>derived_<span class='shy'></span>dimension<isq​::​dim_<span class='shy'></span>length, per<power<isq​::​dim_<span class='shy'></span>time, 2>>></span></span>
|
||
</span> — <i>end example</i>]</div></div> <div id='qty.dim.types-2.sentence-2' class='sentence'>
|
||
A program that instantiates a specialization of <span class='texttt'>derived_<span class='shy'></span>dimension</span>
|
||
that is not a possible result of the library specifications
|
||
is ill-formed, no diagnostic required<a class='hidden_link' href='#qty.dim.types-2.sentence-2'>.</a></div></div><div class='texpara'><span id='lib:dimension_one'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:dimension_one'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>struct</span> dimension_one <span class='keyword'>final</span> <span class='operator'>:</span> <i >dimension-interface</i>, <i >derived-dimension-impl</i><span class='anglebracket'><</span><span class='anglebracket'>></span> <span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></div></div><div class='para' id='qty.dim.types-3'><div class='marginalizedparent'><a class='marginalized' href='#qty.dim.types-3'>3</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1422'>#</a></div><div class='texpara'><div id='qty.dim.types-3.sentence-1' class='sentence'><span class='texttt'>dimension_<span class='shy'></span>one</span> represents the dimension of a quantity of dimension one (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-13">IEC 60050, 112-01-13</a>)<a class='hidden_link' href='#qty.dim.types-3.sentence-1'>.</a></div></div></div></div><div id='qty.dim.ops' class='section'><h4 ><a class='secnum' href='#qty.dim.ops' style='min-width:95pt'>5.4.2.4</a> Operations <a class='abbr_ref' href='qty.dim.ops.html'>[qty.dim.ops]</a></h4><div class='texpara'><span id='lib:dimension-interface'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:dimension-interface'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>struct</span> <i >dimension-interface</i> <span class='curlybracket'>{</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension___'><span class='tcode_in_codeblock'>Dimension</span></span></a> Lhs, <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension____'><span class='tcode_in_codeblock'>Dimension</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension_____'><span class='tcode_in_codeblock'>Dimension</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span>Lhs, Rhs<span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension______'><span class='tcode_in_codeblock'>Dimension</span></span></a> Lhs, <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension_______'><span class='tcode_in_codeblock'>Dimension</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension________'><span class='tcode_in_codeblock'>Dimension</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>/</span><span class='parenthesis'>(</span>Lhs, Rhs<span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension_________'><span class='tcode_in_codeblock'>Dimension</span></span></a> Lhs, <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension__________'><span class='tcode_in_codeblock'>Dimension</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> <span class='keyword'>operator</span><span class='operator'>=</span><span class='operator'>=</span><span class='parenthesis'>(</span>Lhs, Rhs<span class='parenthesis'>)</span>;
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></div><div class='texpara'><div id='lib:Dimension,operator*'><div id='lib:operator*,Dimension'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator*,Dimension'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension___________'><span class='texttt'>Dimension</span></span></a> Lhs, <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension____________'><span class='texttt'>Dimension</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension_____________'><span class='texttt'>Dimension</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span>Lhs, Rhs<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.dim.ops-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.dim.ops-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1452'>#</a></div><div class='texpara'><div id='qty.dim.ops-1.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'><span class='texttt'><i >expr-multiply</i></span><span class='anglebracket'><</span>derived_<span class='shy'></span>dimension, <span class='keyword'>struct</span> dimension_<span class='shy'></span>one<span class='anglebracket'>></span><span class='parenthesis'>(</span>Lhs<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Rhs<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.dim.ops-1.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Dimension,operator/'><div id='lib:operator/,Dimension'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator/,Dimension'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension______________'><span class='texttt'>Dimension</span></span></a> Lhs, <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension_______________'><span class='texttt'>Dimension</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension________________'><span class='texttt'>Dimension</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>/</span><span class='parenthesis'>(</span>Lhs, Rhs<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.dim.ops-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.dim.ops-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1464'>#</a></div><div class='texpara'><div id='qty.dim.ops-2.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'><span class='texttt'><i >expr-divide</i></span><span class='anglebracket'><</span>derived_<span class='shy'></span>dimension, <span class='keyword'>struct</span> dimension_<span class='shy'></span>one<span class='anglebracket'>></span><span class='parenthesis'>(</span>Lhs<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Rhs<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.dim.ops-2.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Dimension,operator=='><div id='lib:operator==,Dimension'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator==,Dimension'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension_________________'><span class='texttt'>Dimension</span></span></a> Lhs, <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension__________________'><span class='texttt'>Dimension</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> <span class='keyword'>operator</span><span class='operator'>=</span><span class='operator'>=</span><span class='parenthesis'>(</span>Lhs, Rhs<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.dim.ops-3'><div class='marginalizedparent'><a class='marginalized' href='#qty.dim.ops-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1476'>#</a></div><div class='texpara'><div id='qty.dim.ops-3.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>std<span class='operator'>​::​</span>is_<span class='shy'></span>same_<span class='shy'></span>v<span class='anglebracket'><</span>Lhs, Rhs<span class='anglebracket'>></span></span><a class='hidden_link' href='#qty.dim.ops-3.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Dimension,inverse'><div id='lib:inverse,Dimension'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:inverse,Dimension'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension___________________'><span class='texttt'>Dimension</span></span></a> <span class='keyword'>auto</span> inverse<span class='parenthesis'>(</span><a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension____________________'><span class='texttt'>Dimension</span></span></a> <span class='keyword'>auto</span> d<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.dim.ops-4'><div class='marginalizedparent'><a class='marginalized' href='#qty.dim.ops-4'>4</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1487'>#</a></div><div class='texpara'><div id='qty.dim.ops-4.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>dimension_<span class='shy'></span>one <span class='operator'>/</span> d</span><a class='hidden_link' href='#qty.dim.ops-4.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Dimension,pow'><div id='lib:pow,Dimension'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:pow,Dimension'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span>std<span class='operator'>::</span>intmax_t Num, std<span class='operator'>::</span>intmax_t Den <span class='operator'>=</span> <span class='literal'>1</span>, <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension_____________________'><span class='texttt'>Dimension</span></span></a> D<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span>Den <span class='operator'>!</span><span class='operator'>=</span> <span class='literal'>0</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>consteval</span> <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension______________________'><span class='texttt'>Dimension</span></span></a> <span class='keyword'>auto</span> pow<span class='parenthesis'>(</span>D d<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.dim.ops-5'><div class='marginalizedparent'><a class='marginalized' href='#qty.dim.ops-5'>5</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1500'>#</a></div><div class='texpara'><div id='qty.dim.ops-5.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'><span class='texttt'><i >expr-pow</i></span><span class='anglebracket'><</span>Num, Den, derived_<span class='shy'></span>dimension, <span class='keyword'>struct</span> dimension_<span class='shy'></span>one<span class='anglebracket'>></span><span class='parenthesis'>(</span>d<span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.dim.ops-5.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Dimension,sqrt'><div id='lib:sqrt,Dimension'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:sqrt,Dimension'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension_______________________'><span class='texttt'>Dimension</span></span></a> <span class='keyword'>auto</span> sqrt<span class='parenthesis'>(</span><a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension________________________'><span class='texttt'>Dimension</span></span></a> <span class='keyword'>auto</span> d<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.dim.ops-6'><div class='marginalizedparent'><a class='marginalized' href='#qty.dim.ops-6'>6</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1511'>#</a></div><div class='texpara'><div id='qty.dim.ops-6.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>pow<span class='anglebracket'><</span><span class='literal'>1</span>, <span class='literal'>2</span><span class='anglebracket'>></span><span class='parenthesis'>(</span>d<span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.dim.ops-6.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Dimension,cbrt'><div id='lib:cbrt,Dimension'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:cbrt,Dimension'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension_________________________'><span class='texttt'>Dimension</span></span></a> <span class='keyword'>auto</span> cbrt<span class='parenthesis'>(</span><a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension__________________________'><span class='texttt'>Dimension</span></span></a> <span class='keyword'>auto</span> d<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.dim.ops-7'><div class='marginalizedparent'><a class='marginalized' href='#qty.dim.ops-7'>7</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1522'>#</a></div><div class='texpara'><div id='qty.dim.ops-7.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>pow<span class='anglebracket'><</span><span class='literal'>1</span>, <span class='literal'>3</span><span class='anglebracket'>></span><span class='parenthesis'>(</span>d<span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.dim.ops-7.sentence-1'>.</a></div></div></div></div></div><div id='qty.dim.sym.fmt' class='section'><h4 ><a class='secnum' href='#qty.dim.sym.fmt' style='min-width:95pt'>5.4.2.5</a> Symbol formatting <a class='abbr_ref' href='qty.dim.sym.fmt.html'>[qty.dim.sym.fmt]</a></h4><div class='texpara'><div id='lib:Dimension,dimension_symbol_to'><div id='lib:dimension_symbol_to,Dimension'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:dimension_symbol_to,Dimension'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> CharT <span class='operator'>=</span> <span class='keyword'>char</span>, std<span class='operator'>::</span>output_iterator<span class='anglebracket'><</span>CharT<span class='anglebracket'>></span> Out, <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension___________________________'><span class='texttt'>Dimension</span></span></a> D<span class='anglebracket'>></span>
|
||
<span class='keyword'>constexpr</span> Out dimension_symbol_to<span class='parenthesis'>(</span>Out out, D d, <span class='keyword'>const</span> dimension_symbol_formatting<span class='operator'>&</span> fmt <span class='operator'>=</span> <span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.dim.sym.fmt-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.dim.sym.fmt-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1536'>#</a></div><div class='texpara'><div id='qty.dim.sym.fmt-1.sentence-1' class='sentence'><i >Effects</i>: TBD<a class='hidden_link' href='#qty.dim.sym.fmt-1.sentence-1'>.</a></div></div></div></div><div class='para' id='qty.dim.sym.fmt-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.dim.sym.fmt-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1540'>#</a></div><div class='texpara'><div id='qty.dim.sym.fmt-2.sentence-1' class='sentence'><i >Returns</i>: TBD<a class='hidden_link' href='#qty.dim.sym.fmt-2.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Dimension,dimension_symbol'><div id='lib:dimension_symbol,Dimension'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:dimension_symbol,Dimension'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span>dimension_symbol_formatting fmt <span class='operator'>=</span> <span class='curlybracket'>{</span><span class='curlybracket'>}</span>, <span class='keyword'>typename</span> CharT <span class='operator'>=</span> <span class='keyword'>char</span>, <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension____________________________'><span class='texttt'>Dimension</span></span></a> D<span class='anglebracket'>></span>
|
||
<span class='keyword'>consteval</span> std<span class='operator'>::</span>string_view dimension_symbol<span class='parenthesis'>(</span>D<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.dim.sym.fmt-3'><div class='marginalizedparent'><a class='marginalized' href='#qty.dim.sym.fmt-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1552'>#</a></div><div class='texpara'><div id='qty.dim.sym.fmt-3.sentence-1' class='sentence'><i >Effects</i>: Equivalent to:
|
||
<span class='codeblock'>TBD<span class='operator'>.</span>
|
||
</span></div></div></div></div></div></div><div id='qty.spec' class='section'><h3 ><a class='secnum' href='#qty.spec' style='min-width:80pt'>5.4.3</a> Quantity specification <a class='abbr_ref' href='qty.spec.html'>[qty.spec]</a></h3><div id='qty.spec.general' class='section'><h4 ><a class='secnum' href='#qty.spec.general' style='min-width:95pt'>5.4.3.1</a> General <a class='abbr_ref' href='qty.spec.general.html'>[qty.spec.general]</a></h4><div class='para' id='qty.spec.general-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.spec.general-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1564'>#</a></div><div class='texpara'><div id='qty.spec.general-1.sentence-1' class='sentence'>Subclause <a href='#qty.spec' title='5.4.3 Quantity specification'>[qty.<span class='shy'></span>spec]</a> specifies the components
|
||
for defining a quantity (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-01">IEC 60050, 112-01-01</a>)<a class='hidden_link' href='#qty.spec.general-1.sentence-1'>.</a></div></div></div></div><div id='qty.spec.concepts' class='section'><h4 ><a class='secnum' href='#qty.spec.concepts' style='min-width:95pt'>5.4.3.2</a> Concepts <a class='abbr_ref' href='qty.spec.concepts.html'>[qty.spec.concepts]</a></h4><div class='texpara'><div class='itemdecl' id='qty.spec.concepts-itemdecl:1'><div class='marginalizedparent'><a class='itemDeclLink' href='#qty.spec.concepts-itemdecl:1'>🔗</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> <a class='hidden_link' href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='concept:QuantitySpec'><span id='lib:QuantitySpec'><span class='texttt'>QuantitySpec</span></span></span></a> <span class='operator'>=</span> <a class='index' id='conceptref:SymbolicConstant__'></a><span class='texttt'><i >SymbolicConstant</i></span><span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> std<span class='operator'>::</span>derived_from<span class='anglebracket'><</span>T, <span class='texttt'><i >quantity-spec-interface</i></span><span class='anglebracket'>></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> <span class='texttt'><i >QuantityKindSpec</i></span><a class='index' id='concept:QuantityKindSpec'></a> <span class='operator'>=</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <span class='texttt'><i >is-specialization-of</i></span><span class='anglebracket'><</span>T, kind_of_<span class='anglebracket'>></span><span class='parenthesis'>(</span><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> <span class='texttt'><i >NamedQuantitySpec</i></span><a class='index' id='concept:NamedQuantitySpec'></a> <span class='operator'>=</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <span class='texttt'><i >is-derived-from-specialization-of</i></span><span class='anglebracket'><</span>T, quantity_spec<span class='anglebracket'>></span><span class='parenthesis'>(</span><span class='parenthesis'>)</span> <span class='operator'>&</span><span class='operator'>&</span>
|
||
<span class='parenthesis'>(</span><span class='operator'>!</span><a class='index' id='conceptref:QuantityKindSpec'></a><span class='texttt'><i >QuantityKindSpec</i></span><span class='anglebracket'><</span>T<span class='anglebracket'>></span><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> <span class='texttt'><i >DerivedQuantitySpec</i></span><a class='index' id='concept:DerivedQuantitySpec'></a> <span class='operator'>=</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec__'><span class='texttt'>QuantitySpec</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='texttt'><i >is-specialization-of</i></span><span class='anglebracket'><</span>T, derived_quantity_spec<span class='anglebracket'>></span><span class='parenthesis'>(</span><span class='parenthesis'>)</span> <span class='operator'>|</span><span class='operator'>|</span>
|
||
<span class='parenthesis'>(</span><a class='index' id='conceptref:QuantityKindSpec_'></a><span class='texttt'><i >QuantityKindSpec</i></span><span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span>
|
||
<span class='texttt'><i >is-specialization-of</i></span><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span><span class='keyword'>auto</span><span class='parenthesis'>(</span>T<span class='operator'>::</span><span class='texttt'><i >quantity-spec</i></span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>, derived_quantity_spec<span class='anglebracket'>></span><span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>auto</span> Child, <span class='keyword'>auto</span> Parent<span class='anglebracket'>></span>
|
||
<span class='keyword'>concept</span> <span class='texttt'><i >ChildQuantitySpecOf</i></span><a class='index' id='concept:ChildQuantitySpecOf'></a> <span class='operator'>=</span> <span class='parenthesis'>(</span><span class='texttt'><i >is-child-of</i></span><span class='parenthesis'>(</span>Child, Parent<span class='parenthesis'>)</span><span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>auto</span> To, <span class='keyword'>auto</span> From<span class='anglebracket'>></span>
|
||
<span class='keyword'>concept</span> <span class='texttt'><i >NestedQuantityKindSpecOf</i></span><a class='index' id='concept:NestedQuantityKindSpecOf'></a> <span class='operator'>=</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec___'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>From<span class='parenthesis'>)</span><span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec____'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>To<span class='parenthesis'>)</span><span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span>
|
||
<span class='parenthesis'>(</span>get_kind<span class='parenthesis'>(</span>From<span class='parenthesis'>)</span> <span class='operator'>!</span><span class='operator'>=</span> get_kind<span class='parenthesis'>(</span>To<span class='parenthesis'>)</span><span class='parenthesis'>)</span> <span class='operator'>&</span><span class='operator'>&</span> <a class='index' id='conceptref:ChildQuantitySpecOf'></a><span class='texttt'><i >ChildQuantitySpecOf</i></span><span class='anglebracket'><</span>To, get_kind<span class='parenthesis'>(</span>From<span class='parenthesis'>)</span><span class='operator'>.</span><span class='texttt'><i >quantity-spec</i></span><span class='anglebracket'>></span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>auto</span> From, <span class='keyword'>auto</span> To<span class='anglebracket'>></span>
|
||
<span class='keyword'>concept</span> <span class='texttt'><i >QuantitySpecConvertibleTo</i></span><a class='index' id='concept:QuantitySpecConvertibleTo'></a> <span class='operator'>=</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_____'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>From<span class='parenthesis'>)</span><span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec______'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>To<span class='parenthesis'>)</span><span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> implicitly_convertible<span class='parenthesis'>(</span>From, To<span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>auto</span> From, <span class='keyword'>auto</span> To<span class='anglebracket'>></span>
|
||
<span class='keyword'>concept</span> <span class='texttt'><i >QuantitySpecExplicitlyConvertibleTo</i></span><a class='index' id='concept:QuantitySpecExplicitlyConvertibleTo'></a> <span class='operator'>=</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_______'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>From<span class='parenthesis'>)</span><span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec________'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>To<span class='parenthesis'>)</span><span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> explicitly_convertible<span class='parenthesis'>(</span>From, To<span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>auto</span> From, <span class='keyword'>auto</span> To<span class='anglebracket'>></span>
|
||
<span class='keyword'>concept</span> <span class='texttt'><i >QuantitySpecCastableTo</i></span><a class='index' id='concept:QuantitySpecCastableTo'></a> <span class='operator'>=</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_________'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>From<span class='parenthesis'>)</span><span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec__________'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>To<span class='parenthesis'>)</span><span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> castable<span class='parenthesis'>(</span>From, To<span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> T, <span class='keyword'>auto</span> QS<span class='anglebracket'>></span>
|
||
<span class='keyword'>concept</span> <a class='hidden_link' href='#concept:QuantitySpecOf' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='concept:QuantitySpecOf'><span id='lib:QuantitySpecOf'><span class='texttt'>QuantitySpecOf</span></span></span></a> <span class='operator'>=</span>
|
||
<a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec___________'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec____________'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>QS<span class='parenthesis'>)</span><span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <a class='index' id='conceptref:QuantitySpecConvertibleTo'></a><span class='texttt'><i >QuantitySpecConvertibleTo</i></span><span class='anglebracket'><</span>T<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, QS<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span>
|
||
<span class='operator'>!</span><a class='index' id='conceptref:NestedQuantityKindSpecOf'></a><span class='texttt'><i >NestedQuantityKindSpecOf</i></span><span class='anglebracket'><</span>T<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, QS<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span>
|
||
<span class='parenthesis'>(</span><a class='index' id='conceptref:QuantityKindSpec__'></a><span class='texttt'><i >QuantityKindSpec</i></span><span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>|</span><span class='operator'>|</span> <span class='operator'>!</span><a class='index' id='conceptref:NestedQuantityKindSpecOf_'></a><span class='texttt'><i >NestedQuantityKindSpecOf</i></span><span class='anglebracket'><</span>QS, T<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span><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> <span class='texttt'><i >QSProperty</i></span><a class='index' id='concept:QSProperty'></a> <span class='operator'>=</span> <span class='parenthesis'>(</span><span class='operator'>!</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_____________'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'><</span>T<span class='anglebracket'>></span><span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
</code></div></div></div><div id='qty.spec.types' class='section'><h4 ><a class='secnum' href='#qty.spec.types' style='min-width:95pt'>5.4.3.3</a> Types <a class='abbr_ref' href='qty.spec.types.html'>[qty.spec.types]</a></h4><div id='named.qty' class='section'><h4 ><a class='secnum' href='#named.qty' style='min-width:110pt'>5.4.3.3.1</a> Named <a class='abbr_ref' href='named.qty.html'>[named.qty]</a></h4><div class='texpara'><span id='lib:quantity_spec'><span id='lib:is_kind'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:is_kind'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>struct</span> is_kind <span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a class='index' id='conceptref:BaseDimension'></a><i >BaseDimension</i> <span class='keyword'>auto</span> Dim, <a class='index' id='conceptref:QSProperty'></a><i >QSProperty</i> <span class='keyword'>auto</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> Args<span class='anglebracket'>></span>
|
||
<span class='keyword'>struct</span> quantity_spec<span class='anglebracket'><</span>Dim, Args<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>></span> <span class='operator'>:</span> <i >quantity-spec-interface</i> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>using</span> <i >base-type</i> <span class='operator'>=</span> quantity_spec;
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <a class='index' id='conceptref:BaseDimension_'></a><i >BaseDimension</i> <span class='keyword'>auto</span> dimension <span class='operator'>=</span> Dim;
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> quantity_character character <span class='operator'>=</span> <i ><span class='texttt'>see below</span></i>;
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a class='index' id='conceptref:DerivedQuantitySpec'></a><i >DerivedQuantitySpec</i> <span class='keyword'>auto</span> Eq, <a class='index' id='conceptref:QSProperty_'></a><i >QSProperty</i> <span class='keyword'>auto</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> Args<span class='anglebracket'>></span>
|
||
<span class='keyword'>struct</span> quantity_spec<span class='anglebracket'><</span>Eq, Args<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>></span> <span class='operator'>:</span> <i >quantity-spec-interface</i> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>using</span> <i >base-type</i> <span class='operator'>=</span> quantity_spec;
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >equation</i> <span class='operator'>=</span> Eq;
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension_____________________________'><span class='tcode_in_codeblock'>Dimension</span></span></a> <span class='keyword'>auto</span> dimension <span class='operator'>=</span> Eq<span class='operator'>.</span>dimension;
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> quantity_character character <span class='operator'>=</span> <i ><span class='texttt'>see below</span></i>;
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a class='index' id='conceptref:NamedQuantitySpec'></a><i >NamedQuantitySpec</i> <span class='keyword'>auto</span> QS, <a class='index' id='conceptref:QSProperty__'></a><i >QSProperty</i> <span class='keyword'>auto</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> Args<span class='anglebracket'>></span>
|
||
<span class='keyword'>struct</span> quantity_spec<span class='anglebracket'><</span>QS, Args<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>></span> <span class='operator'>:</span> <i >quantity-spec-interface</i> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>using</span> <i >base-type</i> <span class='operator'>=</span> quantity_spec;
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >parent</i> <span class='operator'>=</span> QS;
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >equation</i> <span class='operator'>=</span> <i >parent</i><span class='operator'>.</span><i >equation</i>; <span class='comment'>// <i >exposition only</i>, present only</span>
|
||
<span class='comment'>// if the <span class='textsf'><i >qualified-id</i></span> <span class='tcode_in_codeblock'><span class='tcode_in_codeblock'><i >parent</i></span>.<span class='tcode_in_codeblock'><i >equation</i></span></span> is valid and denotes an object</span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension______________________________'><span class='tcode_in_codeblock'>Dimension</span></span></a> <span class='keyword'>auto</span> dimension <span class='operator'>=</span> <i >parent</i><span class='operator'>.</span>dimension;
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> quantity_character character <span class='operator'>=</span> <i ><span class='texttt'>see below</span></i>;
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a class='index' id='conceptref:NamedQuantitySpec_'></a><i >NamedQuantitySpec</i> <span class='keyword'>auto</span> QS, <a class='index' id='conceptref:DerivedQuantitySpec_'></a><i >DerivedQuantitySpec</i> <span class='keyword'>auto</span> Eq, <a class='index' id='conceptref:QSProperty___'></a><i >QSProperty</i> <span class='keyword'>auto</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> Args<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span> <a class='index' id='conceptref:QuantitySpecExplicitlyConvertibleTo'></a><i >QuantitySpecExplicitlyConvertibleTo</i><span class='anglebracket'><</span>Eq, QS<span class='anglebracket'>></span>
|
||
<span class='keyword'>struct</span> quantity_spec<span class='anglebracket'><</span>QS, Eq, Args<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>></span> <span class='operator'>:</span> <i >quantity-spec-interface</i> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>using</span> <i >base-type</i> <span class='operator'>=</span> quantity_spec;
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >parent</i> <span class='operator'>=</span> QS;
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >equation</i> <span class='operator'>=</span> Eq;
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension_______________________________'><span class='tcode_in_codeblock'>Dimension</span></span></a> <span class='keyword'>auto</span> dimension <span class='operator'>=</span> <i >parent</i><span class='operator'>.</span>dimension;
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> quantity_character character <span class='operator'>=</span> <i ><span class='texttt'>see below</span></i>;
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></span></div><div class='para' id='named.qty-1'><div class='marginalizedparent'><a class='marginalized' href='#named.qty-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1669'>#</a></div><div class='texpara'><div id='named.qty-1.sentence-1' class='sentence'>A <a class='hidden_link' href='#def:quantity,named' title='5.4.3.3.1 Named [named.qty]'><span id='def:quantity,named'><i >named quantity</i></span></a> is a type that models <a class='index' id='conceptref:NamedQuantitySpec__'></a><span class='texttt'><i >NamedQuantitySpec</i></span><a class='hidden_link' href='#named.qty-1.sentence-1'>.</a></div> <div id='named.qty-1.sentence-2' class='sentence'>A specialization of <span class='texttt'>quantity_<span class='shy'></span>spec</span> is used as a base type when defining a named quantity<a class='hidden_link' href='#named.qty-1.sentence-2'>.</a></div></div></div><div class='para' id='named.qty-2'><div class='marginalizedparent'><a class='marginalized' href='#named.qty-2'>2</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1673'>#</a></div><div class='texpara'><div id='named.qty-2.sentence-1' class='sentence'>In the following descriptions, let <span class='texttt'>Q</span> be a named quantity defined with an alluded signature<a class='hidden_link' href='#named.qty-2.sentence-1'>.</a></div> <div id='named.qty-2.sentence-2' class='sentence'>The identifier of <span class='texttt'>Q</span> represents its quantity name (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-02">IEC 60050, 112-01-02</a>)<a class='hidden_link' href='#named.qty-2.sentence-2'>.</a></div></div></div><div class='para' id='named.qty-3'><div class='marginalizedparent'><a class='marginalized' href='#named.qty-3'>3</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1677'>#</a></div><div class='texpara'><div id='named.qty-3.sentence-1' class='sentence'>Let <span class='texttt'>Ch</span> be an enumerator value of <span class='texttt'>quantity_<span class='shy'></span>character</span><a class='hidden_link' href='#named.qty-3.sentence-1'>.</a></div> <div id='named.qty-3.sentence-2' class='sentence'>The possible arguments to <span class='texttt'>quantity_<span class='shy'></span>spec</span> are
|
||
<ul class='itemize'><li id='named.qty-3.1'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#named.qty-3.1'>(3.1)</a></div><span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">(</span></span><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.519em;">a base quantity dimension</span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><span class="mjx-msubsup MJXc-space1"><span class="mjx-base"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-type-R" style="padding-top: 0.446em; padding-bottom: 0.298em;">Ch</span></span></span></span></span><span class="mjx-sub" style="font-size: 70.7%; vertical-align: -0.212em; padding-right: 0.071em;"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mstyle" style="font-size: 113.1%; color: black;"><span class="mjx-mrow" style="font-size: 88.4%;"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.225em; padding-bottom: 0.298em;">o</span></span></span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.225em; padding-bottom: 0.446em;">p</span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.372em; padding-bottom: 0.298em;">t</span></span></span></span></span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">)</span></span></span></span></span>,</li><li id='named.qty-3.2'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#named.qty-3.2'>(3.2)</a></div><span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">(</span></span><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.519em;">a quantity calculus</span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><span class="mjx-msubsup MJXc-space1"><span class="mjx-base"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-type-R" style="padding-top: 0.446em; padding-bottom: 0.298em;">Ch</span></span></span></span></span><span class="mjx-sub" style="font-size: 70.7%; vertical-align: -0.212em; padding-right: 0.071em;"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mstyle" style="font-size: 113.1%; color: black;"><span class="mjx-mrow" style="font-size: 88.4%;"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.225em; padding-bottom: 0.298em;">o</span></span></span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.225em; padding-bottom: 0.446em;">p</span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.372em; padding-bottom: 0.298em;">t</span></span></span></span></span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">)</span></span></span></span></span>,</li><li id='named.qty-3.3'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#named.qty-3.3'>(3.3)</a></div><span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">(</span></span><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.519em;">a named quantity</span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><span class="mjx-msubsup MJXc-space1"><span class="mjx-base"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-type-R" style="padding-top: 0.446em; padding-bottom: 0.298em;">Ch</span></span></span></span></span><span class="mjx-sub" style="font-size: 70.7%; vertical-align: -0.212em; padding-right: 0.071em;"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mstyle" style="font-size: 113.1%; color: black;"><span class="mjx-mrow" style="font-size: 88.4%;"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.225em; padding-bottom: 0.298em;">o</span></span></span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.225em; padding-bottom: 0.446em;">p</span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.372em; padding-bottom: 0.298em;">t</span></span></span></span></span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><span class="mjx-msubsup MJXc-space1"><span class="mjx-base"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-type-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">is_kind</span></span></span></span></span><span class="mjx-sub" style="font-size: 70.7%; vertical-align: -0.22em; padding-right: 0.071em;"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mstyle" style="font-size: 113.1%; color: black;"><span class="mjx-mrow" style="font-size: 88.4%;"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.225em; padding-bottom: 0.298em;">o</span></span></span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.225em; padding-bottom: 0.446em;">p</span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.372em; padding-bottom: 0.298em;">t</span></span></span></span></span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">)</span></span></span></span></span>, and</li><li id='named.qty-3.4'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#named.qty-3.4'>(3.4)</a></div><span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">(</span></span><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.519em;">a named quantity</span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><span class="mjx-mtext MJXc-space1"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.519em;">a quantity calculus</span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><span class="mjx-msubsup MJXc-space1"><span class="mjx-base"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-type-R" style="padding-top: 0.446em; padding-bottom: 0.298em;">Ch</span></span></span></span></span><span class="mjx-sub" style="font-size: 70.7%; vertical-align: -0.212em; padding-right: 0.071em;"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mstyle" style="font-size: 113.1%; color: black;"><span class="mjx-mrow" style="font-size: 88.4%;"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.225em; padding-bottom: 0.298em;">o</span></span></span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.225em; padding-bottom: 0.446em;">p</span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.372em; padding-bottom: 0.298em;">t</span></span></span></span></span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><span class="mjx-msubsup MJXc-space1"><span class="mjx-base"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-type-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">is_kind</span></span></span></span></span><span class="mjx-sub" style="font-size: 70.7%; vertical-align: -0.22em; padding-right: 0.071em;"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mstyle" style="font-size: 113.1%; color: black;"><span class="mjx-mrow" style="font-size: 88.4%;"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.225em; padding-bottom: 0.298em;">o</span></span></span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.225em; padding-bottom: 0.446em;">p</span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.372em; padding-bottom: 0.298em;">t</span></span></span></span></span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">)</span></span></span></span></span><a class='hidden_link' href='#named.qty-3.sentence-2'>.</a></li></ul></div></div></div><div class='para' id='named.qty-4'><div class='marginalizedparent'><a class='marginalized' href='#named.qty-4'>4</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1691'>#</a></div><div class='texpara'><div id='named.qty-4.sentence-1' class='sentence'>If the first argument is a base quantity dimension,
|
||
then <span class='texttt'>Q</span> is that base quantity (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-08">IEC 60050, 112-01-08</a>)<a class='hidden_link' href='#named.qty-4.sentence-1'>.</a></div> <div id='named.qty-4.sentence-2' class='sentence'>If an argument is a quantity calculus (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-30">IEC 60050, 112-01-30</a>) <i >C</i>,
|
||
then <span class='texttt'>Q</span> is implicitly convertible from <i >C</i><a class='hidden_link' href='#named.qty-4.sentence-2'>.</a></div> <div id='named.qty-4.sentence-3' class='sentence'>If the first argument is a named quantity,
|
||
then <span class='texttt'>Q</span> is of its kind (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-04">IEC 60050, 112-01-04</a>)<a class='hidden_link' href='#named.qty-4.sentence-3'>.</a></div></div></div><div class='para' id='named.qty-5'><div class='marginalizedparent'><a class='marginalized' href='#named.qty-5'>5</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1699'>#</a></div><div class='texpara'><div id='named.qty-5.sentence-1' class='sentence'>The member <span class='texttt'>character</span> represents
|
||
the set of the numerical value of <span class='texttt'>Q</span> (<a href='qty.char.traits.html' title='5.5.2.2 Quantity character'>[qty.<span class='shy'></span>char.<span class='shy'></span>traits]</a>)
|
||
and is equal to
|
||
<ul class='itemize'><li id='named.qty-5.1'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#named.qty-5.1'>(5.1)</a></div><span class='texttt'>Ch</span> if specified,</li><li id='named.qty-5.2'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#named.qty-5.2'>(5.2)</a></div>otherwise, <span class='texttt'>quantity_<span class='shy'></span>character<span class='operator'>​::​</span>scalar</span> for the first signature, and</li><li id='named.qty-5.3'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#named.qty-5.3'>(5.3)</a></div>otherwise, <span class='texttt'><span class='parenthesis'>(</span>BC<span class='parenthesis'>)</span><span class='operator'>.</span>character</span>,
|
||
where <span class='texttt'>BC</span> is the argument preceding <span class='texttt'>Ch</span> in the signatures above<a class='hidden_link' href='#named.qty-5.sentence-1'>.</a></li></ul></div></div></div><div class='para' id='named.qty-6'><div class='marginalizedparent'><a class='marginalized' href='#named.qty-6'>6</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1713'>#</a></div><div class='texpara'><div id='named.qty-6.sentence-1' class='sentence'><span class='texttt'>is_<span class='shy'></span>kind</span> specifies <span class='texttt'>Q</span> to start a new hierarchy tree of a kind<a class='hidden_link' href='#named.qty-6.sentence-1'>.</a></div></div></div><div class='para' id='named.qty-7'><div class='marginalizedparent'><a class='marginalized' href='#named.qty-7'>7</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1716'>#</a></div><div class='texpara'><div id='named.qty-7.sentence-1' class='sentence'>Optional arguments may appear in any order<a class='hidden_link' href='#named.qty-7.sentence-1'>.</a></div></div></div><div class='para nonNormativeOnly' id='named.qty-8'><div class='marginalizedparent'><a class='marginalized' href='#named.qty-8'>8</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1719'>#</a></div><div class='texpara'><div id='named.qty-example-1' class='example'><div class='texpara'>[<i>Example <a href='#named.qty-example-1'>1</a></i>: <span class='codeblock'><span class='comment'>// The first signature defines a base quantity.</span>
|
||
<span class='keyword'>inline</span> <span class='keyword'>constexpr</span> <span class='keyword'>struct</span> length <span class='keyword'>final</span> <span class='operator'>:</span> quantity_spec<span class='anglebracket'><</span>dim_length<span class='anglebracket'>></span> <span class='curlybracket'>{</span>
|
||
<span class='curlybracket'>}</span> length; <span class='comment'>// Length is a base quantity.</span>
|
||
|
||
<span class='comment'>// The second signature defines a derived quantity.</span>
|
||
<span class='keyword'>inline</span> <span class='keyword'>constexpr</span> <span class='keyword'>struct</span> area <span class='keyword'>final</span> <span class='operator'>:</span> quantity_spec<span class='anglebracket'><</span>pow<span class='anglebracket'><</span><span class='literal'>2</span><span class='anglebracket'>></span><span class='parenthesis'>(</span>length<span class='parenthesis'>)</span><span class='anglebracket'>></span> <span class='curlybracket'>{</span>
|
||
<span class='curlybracket'>}</span> area; <span class='comment'>// An area equals length by length.</span>
|
||
|
||
<span class='comment'>// The third and fourth signatures add a leaf to a hierarchy of kinds.</span>
|
||
<span class='keyword'>inline</span> <span class='keyword'>constexpr</span> <span class='keyword'>struct</span> width <span class='keyword'>final</span> <span class='operator'>:</span> quantity_spec<span class='anglebracket'><</span>length<span class='anglebracket'>></span> <span class='curlybracket'>{</span>
|
||
<span class='curlybracket'>}</span> width; <span class='comment'>// Width is a kind of length.</span>
|
||
|
||
<span class='comment'>// The fourth signature also refines the calculus required for implicit conversions.</span>
|
||
<span class='keyword'>inline</span> <span class='keyword'>constexpr</span> <span class='keyword'>struct</span> angular_measure <span class='keyword'>final</span> <span class='operator'>:</span>
|
||
quantity_spec<span class='anglebracket'><</span>dimensionless, arc_length <span class='operator'>/</span> radius, is_kind<span class='anglebracket'>></span> <span class='curlybracket'>{</span>
|
||
<span class='curlybracket'>}</span> angular_measure; <span class='comment'>// Requires an arc length per radius, not just any quantity of dimension one.</span>
|
||
</span> — <i>end example</i>]</div></div></div></div></div><div id='derived.qty' class='section'><h4 ><a class='secnum' href='#derived.qty' style='min-width:110pt'>5.4.3.3.2</a> Derived <a class='abbr_ref' href='derived.qty.html'>[derived.qty]</a></h4><div class='texpara'><span id='lib:derived_quantity_spec'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:derived_quantity_spec'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><i >NamedQuantitySpec</i><a class='index' id='concept:NamedQuantitySpec_'></a> Q<span class='anglebracket'>></span>
|
||
<span class='keyword'>using</span> <i >to-dimension</i> <span class='operator'>=</span> <span class='keyword'>decltype</span><span class='parenthesis'>(</span><span class='keyword'>auto</span><span class='parenthesis'>(</span>Q<span class='operator'>::</span>dimension<span class='parenthesis'>)</span><span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> Expr<span class='anglebracket'>></span>
|
||
<span class='keyword'>struct</span> <i >derived-quantity-spec-impl</i> <span class='operator'>:</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<i >quantity-spec-interface</i>,
|
||
<i >expr-fractions</i><span class='anglebracket'><</span><span class='keyword'>struct</span> dimensionless, Expr<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>></span> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>using</span> <i >base-type</i> <span class='operator'>=</span> <i >derived-quantity-spec-impl</i>;
|
||
<span class='keyword'>using</span> <i >base</i> <span class='operator'>=</span> <i >expr-fractions</i><span class='anglebracket'><</span><span class='keyword'>struct</span> dimensionless, Expr<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>></span>;
|
||
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <a href='#concept:Dimension' title='5.4.2.2 Concepts [qty.dim.concepts]'><span id='conceptref:Dimension________________________________'><span class='tcode_in_codeblock'>Dimension</span></span></a> <span class='keyword'>auto</span> dimension <span class='operator'>=</span>
|
||
<i >expr-map</i><span class='anglebracket'><</span><i >to-dimension</i>, derived_dimension, <span class='keyword'>struct</span> dimension_one<span class='anglebracket'>></span><span class='parenthesis'>(</span><i >base</i><span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>;
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> quantity_character character <span class='operator'>=</span> <i ><span class='texttt'>see below</span></i>;
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a class='index' id='conceptref:SymbolicConstant___'></a><i >SymbolicConstant</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='keyword'>final</span> <span class='operator'>:</span> <i >derived-quantity-spec-impl</i><span class='anglebracket'><</span>Expr<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>></span> <span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></div><div class='para' id='derived.qty-1'><div class='marginalizedparent'><a class='marginalized' href='#derived.qty-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1768'>#</a></div><div class='texpara'><div id='derived.qty-1.sentence-1' class='sentence'><span class='texttt'>derived_<span class='shy'></span>quantity_<span class='shy'></span>spec</span> is used by the library
|
||
to represent the result of a quantity calculus not equal to a named quantity<a class='hidden_link' href='#derived.qty-1.sentence-1'>.</a></div> <div id='derived.qty-example-1' class='example'><div class='texpara'>[<i>Example <a href='#derived.qty-example-1'>1</a></i>: <span class='codeblock'><span class='keyword'>constexpr</span> <span class='keyword'>auto</span> area <span class='operator'>=</span> pow<span class='anglebracket'><</span><span class='literal'>2</span><span class='anglebracket'>></span><span class='parenthesis'>(</span>isq<span class='operator'>::</span>length<span class='parenthesis'>)</span>;
|
||
<span class='keyword'>int</span> x <span class='operator'>=</span> area; <span class='comment'>// error: cannot construct from <span class='tcode_in_codeblock'>derived_<span class='shy'></span>quantity_<span class='shy'></span>spec<power<isq​::​length, 2>></span></span>
|
||
</span> — <i>end example</i>]</div></div> <div id='derived.qty-1.sentence-2' class='sentence'>
|
||
A program that instantiates a specialization of <span class='texttt'>derived_<span class='shy'></span>quantity_<span class='shy'></span>spec</span>
|
||
that is not a possible result of the library specifications
|
||
is ill-formed, no diagnostic required<a class='hidden_link' href='#derived.qty-1.sentence-2'>.</a></div></div></div><div class='para' id='derived.qty-2'><div class='marginalizedparent'><a class='marginalized' href='#derived.qty-2'>2</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1781'>#</a></div><div class='texpara'><div id='derived.qty-2.sentence-1' class='sentence'>Let
|
||
<ul class='itemize'><li id='derived.qty-2.1'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#derived.qty-2.1'>(2.1)</a></div><span class='texttt'>Nums</span> and <span class='texttt'>Dens</span>
|
||
be packs denoting the template arguments of
|
||
<span class='texttt'><span class='texttt'><i >base</i></span><span class='operator'>​::​</span><span class='texttt'><i >nums</i></span></span> and <span class='texttt'><span class='texttt'><i >base</i></span><span class='operator'>​::​</span><span class='texttt'><i >dens</i></span></span>, respectively,</li><li id='derived.qty-2.2'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#derived.qty-2.2'>(2.2)</a></div><span class='texttt'><i >QUANTITY-CHARACTER-OF</i><span class='parenthesis'>(</span>Pack<span class='parenthesis'>)</span></span> be
|
||
<span class='codeblock'>std<span class='operator'>::</span>max<span class='parenthesis'>(</span><span class='curlybracket'>{</span>quantity_character<span class='operator'>::</span>scalar, <i >expr-type</i><span class='anglebracket'><</span>Pack<span class='anglebracket'>></span><span class='operator'>::</span>character<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>
|
||
</span>
|
||
and</li><li id='derived.qty-2.3'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#derived.qty-2.3'>(2.3)</a></div><span class='texttt'>num_<span class='shy'></span>char</span> be <span class='texttt'><i >QUANTITY-CHARACTER-OF</i><span class='parenthesis'>(</span>Nums<span class='parenthesis'>)</span></span> and
|
||
<span class='texttt'>den_<span class='shy'></span>char</span> be <span class='texttt'><i >QUANTITY-CHARACTER-OF</i><span class='parenthesis'>(</span>Dens<span class='parenthesis'>)</span></span><a class='hidden_link' href='#derived.qty-2.sentence-1'>.</a></li></ul></div> <div id='derived.qty-2.sentence-2' class='sentence'>
|
||
The member <span class='texttt'>character</span> is equal to
|
||
<span class='texttt'>quantity_<span class='shy'></span>character<span class='operator'>​::​</span>scalar</span> if <span class='texttt'>num_<span class='shy'></span>char <span class='operator'>=</span><span class='operator'>=</span> den_<span class='shy'></span>char</span> is <span class='texttt'><span class='literal'>true</span></span>, and
|
||
<span class='texttt'>std<span class='operator'>​::​</span>max<span class='parenthesis'>(</span>num_<span class='shy'></span>char, den_<span class='shy'></span>char<span class='parenthesis'>)</span></span> otherwise<a class='hidden_link' href='#derived.qty-2.sentence-2'>.</a></div></div></div></div><div id='dimless.qty' class='section'><h4 ><a class='secnum' href='#dimless.qty' style='min-width:110pt'>5.4.3.3.3</a> Base quantity of dimension one <a class='abbr_ref' href='dimless.qty.html'>[dimless.qty]</a></h4><div class='texpara'><span id='lib:dimensionless'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:dimensionless'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>struct</span> dimensionless <span class='keyword'>final</span> <span class='operator'>:</span> quantity_spec<span class='anglebracket'><</span>derived_quantity_spec<span class='anglebracket'><</span><span class='anglebracket'>></span><span class='anglebracket'>></span> <span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></div><div class='para' id='dimless.qty-1'><div class='marginalizedparent'><a class='marginalized' href='#dimless.qty-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1813'>#</a></div><div class='texpara'><div id='dimless.qty-1.sentence-1' class='sentence'><span class='texttt'>dimensionless</span> represents the base quantity of dimension one (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-13">IEC 60050, 112-01-13</a>)<a class='hidden_link' href='#dimless.qty-1.sentence-1'>.</a></div></div></div></div><div id='kind.of.qty' class='section'><h4 ><a class='secnum' href='#kind.of.qty' style='min-width:110pt'>5.4.3.3.4</a> Kind of <a class='abbr_ref' href='kind.of.qty.html'>[kind.of.qty]</a></h4><div class='texpara'><span id='lib:kind_of_'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:kind_of_'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec______________'><span class='tcode_in_codeblock'>QuantitySpec</span></span></a> Q<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span><span class='operator'>!</span><a class='index' id='conceptref:QuantityKindSpec___'></a><i >QuantityKindSpec</i><span class='anglebracket'><</span>Q<span class='anglebracket'>></span><span class='parenthesis'>)</span> <span class='operator'>&</span><span class='operator'>&</span> <span class='parenthesis'>(</span><i >get-kind-tree-root</i><span class='parenthesis'>(</span>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>struct</span> kind_of_ <span class='keyword'>final</span> <span class='operator'>:</span> Q<span class='operator'>::</span><i >base-type</i> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>using</span> <i >base-type</i> <span class='operator'>=</span> kind_of_; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >quantity-spec</i> <span class='operator'>=</span> Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></div><div class='para' id='kind.of.qty-1'><div class='marginalizedparent'><a class='marginalized' href='#kind.of.qty-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1832'>#</a></div><div class='texpara'><div id='kind.of.qty-1.sentence-1' class='sentence'><span class='texttt'>kind_<span class='shy'></span>of<span class='anglebracket'><</span>Q<span class='anglebracket'>></span></span> represents a kind of quantity (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-04">IEC 60050, 112-01-04</a>) <span class='texttt'>Q</span><a class='hidden_link' href='#kind.of.qty-1.sentence-1'>.</a></div></div></div></div></div><div id='qty.spec.utils' class='section'><h4 ><a class='secnum' href='#qty.spec.utils' style='min-width:95pt'>5.4.3.4</a> Utilities <a class='abbr_ref' href='qty.spec.utils.html'>[qty.spec.utils]</a></h4><div class='texpara'><div id='lib:clone-kind-of,QuantitySpec'><div id='lib:QuantitySpec,clone-kind-of'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:QuantitySpec,clone-kind-of'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_______________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> From, <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec________________'><span class='texttt'>QuantitySpec</span></span></a> Q<span class='anglebracket'>></span>
|
||
<span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_________________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> <span class='texttt'><i >clone-kind-of</i></span><span class='parenthesis'>(</span>Q q<span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
</code></div></div></div></div><div class='para' id='qty.spec.utils-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.spec.utils-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1844'>#</a></div><div class='texpara'><div id='qty.spec.utils-1.sentence-1' class='sentence'><i >Effects</i>: Equivalent to:
|
||
<span class='codeblock'><span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><span class='parenthesis'>(</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> <span class='operator'>&</span><span class='operator'>&</span> <a class='index' id='conceptref:QuantityKindSpec____'></a><i >QuantityKindSpec</i><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>From<span class='parenthesis'>)</span><span class='anglebracket'>></span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> kind_of<span class='anglebracket'><</span>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span>;
|
||
<span class='keyword'>else</span>
|
||
<span class='keyword'>return</span> q;
|
||
</span></div></div></div></div><div class='texpara'><div id='lib:remove-kind,QuantitySpec'><div id='lib:QuantitySpec,remove-kind'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:QuantitySpec,remove-kind'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec__________________'><span class='texttt'>QuantitySpec</span></span></a> Q<span class='anglebracket'>></span>
|
||
<span class='keyword'>consteval</span> <span class='keyword'>auto</span> <span class='texttt'><i >remove-kind</i></span><span class='parenthesis'>(</span>Q q<span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
</code></div></div></div></div><div class='para' id='qty.spec.utils-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.spec.utils-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1862'>#</a></div><div class='texpara'><div id='qty.spec.utils-2.sentence-1' class='sentence'><i >Effects</i>: Equivalent to:
|
||
<span class='codeblock'><span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><a class='index' id='conceptref:QuantityKindSpec_____'></a><i >QuantityKindSpec</i><span class='anglebracket'><</span>Q<span class='anglebracket'>></span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> Q<span class='operator'>::</span><i >quantity-spec</i>;
|
||
<span class='keyword'>else</span>
|
||
<span class='keyword'>return</span> q;
|
||
</span></div></div></div></div><div class='texpara'><div id='lib:make-reference,Unit'><div id='lib:Unit,make-reference'><div id='lib:make-reference,QuantitySpec'><div id='lib:QuantitySpec,make-reference'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:QuantitySpec,make-reference'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec___________________'><span class='texttt'>QuantitySpec</span></span></a> QS, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit'><span class='texttt'>Unit</span></span></a> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span><span class='operator'>!</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit'><span class='texttt'>AssociatedUnit</span></span></a><span class='anglebracket'><</span>U<span class='anglebracket'>></span><span class='parenthesis'>)</span> <span class='operator'>|</span><span class='operator'>|</span> <a href='#concept:UnitOf' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:UnitOf'><span class='texttt'>UnitOf</span></span></a><span class='anglebracket'><</span>U, QS<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span>
|
||
<span class='keyword'>consteval</span> <a href='#concept:Reference' title='5.4.5 Concepts [qty.ref.concepts]'><span id='conceptref:Reference'><span class='texttt'>Reference</span></span></a> <span class='keyword'>auto</span> <span class='texttt'><i >make-reference</i></span><span class='parenthesis'>(</span>QS, U u<span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
</code></div></div></div></div></div></div><div class='para' id='qty.spec.utils-3'><div class='marginalizedparent'><a class='marginalized' href='#qty.spec.utils-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1882'>#</a></div><div class='texpara'><div id='qty.spec.utils-3.sentence-1' class='sentence'><i >Effects</i>: Equivalent to:
|
||
<span class='codeblock'><span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><span class='keyword'>requires</span> <span class='curlybracket'>{</span> <span class='keyword'>requires</span> get_quantity_spec<span class='parenthesis'>(</span>U<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> QS<span class='curlybracket'>{</span><span class='curlybracket'>}</span>; <span class='curlybracket'>}</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> u;
|
||
<span class='keyword'>else</span>
|
||
<span class='keyword'>return</span> reference<span class='anglebracket'><</span>QS, U<span class='anglebracket'>></span><span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
</span></div></div></div></div></div><div id='qty.spec.ops' class='section'><h4 ><a class='secnum' href='#qty.spec.ops' style='min-width:95pt'>5.4.3.5</a> Operations <a class='abbr_ref' href='qty.spec.ops.html'>[qty.spec.ops]</a></h4><div class='texpara'><span id='lib:quantity-spec-interface'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:quantity-spec-interface'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>struct</span> <i >quantity-spec-interface</i> <span class='curlybracket'>{</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec____________________'><span class='tcode_in_codeblock'>QuantitySpec</span></span></a> Lhs, <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_____________________'><span class='tcode_in_codeblock'>QuantitySpec</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec______________________'><span class='tcode_in_codeblock'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span>Lhs lhs, Rhs rhs<span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_______________________'><span class='tcode_in_codeblock'>QuantitySpec</span></span></a> Lhs, <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec________________________'><span class='tcode_in_codeblock'>QuantitySpec</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_________________________'><span class='tcode_in_codeblock'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>/</span><span class='parenthesis'>(</span>Lhs lhs, Rhs rhs<span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Self, <a href='#concept:UnitOf' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:UnitOf_'><span class='tcode_in_codeblock'>UnitOf</span></span></a><span class='anglebracket'><</span>Self<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>consteval</span> <a href='#concept:Reference' title='5.4.5 Concepts [qty.ref.concepts]'><span id='conceptref:Reference_'><span class='tcode_in_codeblock'>Reference</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='squarebracket'>[</span><span class='squarebracket'>]</span><span class='parenthesis'>(</span><span class='keyword'>this</span> Self self, U u<span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Self, <span class='keyword'>typename</span> FwdQ, <a href='qty.syn.html#concept:Quantity' title='5.6.3 Class template quantity [qty.syn]'><span id='conceptref:Quantity'><span class='tcode_in_codeblock'>Quantity</span></span></a> Q <span class='operator'>=</span> std<span class='operator'>::</span>remove_cvref_t<span class='anglebracket'><</span>FwdQ<span class='anglebracket'>></span><span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span> <a class='index' id='conceptref:QuantitySpecExplicitlyConvertibleTo_'></a><i >QuantitySpecExplicitlyConvertibleTo</i><span class='anglebracket'><</span>Q<span class='operator'>::</span>quantity_spec, Self<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span>
|
||
<span class='keyword'>constexpr</span> <a href='qty.syn.html#concept:Quantity' title='5.6.3 Class template quantity [qty.syn]'><span id='conceptref:Quantity_'><span class='tcode_in_codeblock'>Quantity</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>(</span><span class='keyword'>this</span> Self self, FwdQ<span class='operator'>&</span><span class='operator'>&</span> q<span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec__________________________'><span class='tcode_in_codeblock'>QuantitySpec</span></span></a> Lhs, <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec___________________________'><span class='tcode_in_codeblock'>QuantitySpec</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> <span class='keyword'>operator</span><span class='operator'>=</span><span class='operator'>=</span><span class='parenthesis'>(</span>Lhs, Rhs<span class='parenthesis'>)</span>;
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></div><div class='texpara'><div id='lib:QuantitySpec,operator*'><div id='lib:operator*,QuantitySpec'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator*,QuantitySpec'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec____________________________'><span class='texttt'>QuantitySpec</span></span></a> Lhs, <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_____________________________'><span class='texttt'>QuantitySpec</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec______________________________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span>Lhs lhs, Rhs rhs<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.spec.ops-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.spec.ops-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1927'>#</a></div><div class='texpara'><div id='qty.spec.ops-1.sentence-1' class='sentence'><i >Returns</i>: <span class='codeblock'><i >clone-kind-of</i><span class='anglebracket'><</span>Lhs<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Rhs<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span><span class='parenthesis'>(</span><i >expr-multiply</i><span class='anglebracket'><</span>derived_quantity_spec, <span class='keyword'>struct</span> dimensionless<span class='anglebracket'>></span><span class='parenthesis'>(</span>
|
||
<i >remove-kind</i><span class='parenthesis'>(</span>lhs<span class='parenthesis'>)</span>, <i >remove-kind</i><span class='parenthesis'>(</span>rhs<span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
</span></div></div></div></div><div class='texpara'><div id='lib:QuantitySpec,operator/'><div id='lib:operator/,QuantitySpec'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator/,QuantitySpec'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_______________________________'><span class='texttt'>QuantitySpec</span></span></a> Lhs, <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec________________________________'><span class='texttt'>QuantitySpec</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_________________________________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>/</span><span class='parenthesis'>(</span>Lhs lhs, Rhs rhs<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.spec.ops-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.spec.ops-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1942'>#</a></div><div class='texpara'><div id='qty.spec.ops-2.sentence-1' class='sentence'><i >Returns</i>: <span class='codeblock'><i >clone-kind-of</i><span class='anglebracket'><</span>Lhs<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Rhs<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span><span class='parenthesis'>(</span><i >expr-divide</i><span class='anglebracket'><</span>derived_quantity_spec, <span class='keyword'>struct</span> dimensionless<span class='anglebracket'>></span><span class='parenthesis'>(</span>
|
||
<i >remove-kind</i><span class='parenthesis'>(</span>lhs<span class='parenthesis'>)</span>, <i >remove-kind</i><span class='parenthesis'>(</span>rhs<span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
</span></div></div></div></div><div class='texpara'><div id='lib:QuantitySpec,operator[]'><div id='lib:operator[],QuantitySpec'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator%5b%5d,QuantitySpec'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Self, <a href='#concept:UnitOf' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:UnitOf__'><span class='texttt'>UnitOf</span></span></a><span class='anglebracket'><</span>Self<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>consteval</span> <a href='#concept:Reference' title='5.4.5 Concepts [qty.ref.concepts]'><span id='conceptref:Reference__'><span class='texttt'>Reference</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='squarebracket'>[</span><span class='squarebracket'>]</span><span class='parenthesis'>(</span><span class='keyword'>this</span> Self self, U u<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.spec.ops-3'><div class='marginalizedparent'><a class='marginalized' href='#qty.spec.ops-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1957'>#</a></div><div class='texpara'><div id='qty.spec.ops-3.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'><span class='texttt'><i >make-reference</i></span><span class='parenthesis'>(</span>self, u<span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.spec.ops-3.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:QuantitySpec,operator()'><div id='lib:operator(),QuantitySpec'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator(),QuantitySpec'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Self, <span class='keyword'>typename</span> FwdQ, <a href='qty.syn.html#concept:Quantity' title='5.6.3 Class template quantity [qty.syn]'><span id='conceptref:Quantity__'><span class='texttt'>Quantity</span></span></a> Q <span class='operator'>=</span> std<span class='operator'>::</span>remove_cvref_t<span class='anglebracket'><</span>FwdQ<span class='anglebracket'>></span><span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span> <a class='index' id='conceptref:QuantitySpecExplicitlyConvertibleTo__'></a><span class='texttt'><i >QuantitySpecExplicitlyConvertibleTo</i></span><span class='anglebracket'><</span>Q<span class='operator'>::</span>quantity_spec, Self<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span>
|
||
<span class='keyword'>constexpr</span> <a href='qty.syn.html#concept:Quantity' title='5.6.3 Class template quantity [qty.syn]'><span id='conceptref:Quantity___'><span class='texttt'>Quantity</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>(</span><span class='keyword'>this</span> Self self, FwdQ<span class='operator'>&</span><span class='operator'>&</span> q<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.spec.ops-4'><div class='marginalizedparent'><a class='marginalized' href='#qty.spec.ops-4'>4</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1970'>#</a></div><div class='texpara'><div id='qty.spec.ops-4.sentence-1' class='sentence'><i >Returns</i>: <span class='codeblock'>quantity<span class='curlybracket'>{</span>std<span class='operator'>::</span>forward<span class='anglebracket'><</span>FwdQ<span class='anglebracket'>></span><span class='parenthesis'>(</span>q<span class='parenthesis'>)</span><span class='operator'>.</span><i >numerical-value</i>, <i >make-reference</i><span class='parenthesis'>(</span>self, Q<span class='operator'>::</span>unit<span class='parenthesis'>)</span><span class='curlybracket'>}</span>
|
||
</span></div></div></div></div><div class='texpara'><div id='lib:QuantitySpec,operator=='><div id='lib:operator==,QuantitySpec'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator==,QuantitySpec'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec__________________________________'><span class='texttt'>QuantitySpec</span></span></a> Lhs, <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec___________________________________'><span class='texttt'>QuantitySpec</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> <span class='keyword'>operator</span><span class='operator'>=</span><span class='operator'>=</span><span class='parenthesis'>(</span>Lhs, Rhs<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.spec.ops-5'><div class='marginalizedparent'><a class='marginalized' href='#qty.spec.ops-5'>5</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1984'>#</a></div><div class='texpara'><div id='qty.spec.ops-5.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>std<span class='operator'>​::​</span>is_<span class='shy'></span>same_<span class='shy'></span>v<span class='anglebracket'><</span>Lhs, Rhs<span class='anglebracket'>></span></span><a class='hidden_link' href='#qty.spec.ops-5.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:QuantitySpec,inverse'><div id='lib:inverse,QuantitySpec'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:inverse,QuantitySpec'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec____________________________________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> inverse<span class='parenthesis'>(</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_____________________________________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> q<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.spec.ops-6'><div class='marginalizedparent'><a class='marginalized' href='#qty.spec.ops-6'>6</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L1995'>#</a></div><div class='texpara'><div id='qty.spec.ops-6.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>dimensionless <span class='operator'>/</span> q</span><a class='hidden_link' href='#qty.spec.ops-6.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:QuantitySpec,pow'><div id='lib:pow,QuantitySpec'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:pow,QuantitySpec'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span>std<span class='operator'>::</span>intmax_t Num, std<span class='operator'>::</span>intmax_t Den <span class='operator'>=</span> <span class='literal'>1</span>, <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec______________________________________'><span class='texttt'>QuantitySpec</span></span></a> Q<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span>Den <span class='operator'>!</span><span class='operator'>=</span> <span class='literal'>0</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_______________________________________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> pow<span class='parenthesis'>(</span>Q q<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.spec.ops-7'><div class='marginalizedparent'><a class='marginalized' href='#qty.spec.ops-7'>7</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2008'>#</a></div><div class='texpara'><div id='qty.spec.ops-7.sentence-1' class='sentence'><i >Returns</i>: <span class='codeblock'><i >clone-kind-of</i><span class='anglebracket'><</span>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span><span class='parenthesis'>(</span>
|
||
<i >expr-pow</i><span class='anglebracket'><</span>Num, Den, derived_quantity_spec, <span class='keyword'>struct</span> dimensionless<span class='anglebracket'>></span><span class='parenthesis'>(</span><i >remove-kind</i><span class='parenthesis'>(</span>q<span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>;
|
||
</span></div></div></div></div><div class='texpara'><div id='lib:QuantitySpec,sqrt'><div id='lib:sqrt,QuantitySpec'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:sqrt,QuantitySpec'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec________________________________________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> sqrt<span class='parenthesis'>(</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_________________________________________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> q<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.spec.ops-8'><div class='marginalizedparent'><a class='marginalized' href='#qty.spec.ops-8'>8</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2022'>#</a></div><div class='texpara'><div id='qty.spec.ops-8.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>pow<span class='anglebracket'><</span><span class='literal'>1</span>, <span class='literal'>2</span><span class='anglebracket'>></span><span class='parenthesis'>(</span>q<span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.spec.ops-8.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:QuantitySpec,cbrt'><div id='lib:cbrt,QuantitySpec'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:cbrt,QuantitySpec'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec__________________________________________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> cbrt<span class='parenthesis'>(</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec___________________________________________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> q<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.spec.ops-9'><div class='marginalizedparent'><a class='marginalized' href='#qty.spec.ops-9'>9</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2033'>#</a></div><div class='texpara'><div id='qty.spec.ops-9.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>pow<span class='anglebracket'><</span><span class='literal'>1</span>, <span class='literal'>3</span><span class='anglebracket'>></span><span class='parenthesis'>(</span>q<span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.spec.ops-9.sentence-1'>.</a></div></div></div></div></div><div id='qty.spec.hier.algos' class='section'><h4 ><a class='secnum' href='#qty.spec.hier.algos' style='min-width:95pt'>5.4.3.6</a> Hierarchy algorithms <a class='abbr_ref' href='qty.spec.hier.algos.html'>[qty.spec.hier.algos]</a></h4><div id='qty.spec.conv' class='section'><h4 ><a class='secnum' href='#qty.spec.conv' style='min-width:110pt'>5.4.3.6.1</a> Conversion <a class='abbr_ref' href='qty.spec.conv.html'>[qty.spec.conv]</a></h4><div class='texpara'><div id='lib:QuantitySpec,implicitly_convertible'><div id='lib:implicitly_convertible,QuantitySpec'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:implicitly_convertible,QuantitySpec'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <span class='keyword'>bool</span> implicitly_convertible<span class='parenthesis'>(</span>QuantitySpec <span class='keyword'>auto</span> from, QuantitySpec <span class='keyword'>auto</span> to<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.spec.conv-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.spec.conv-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2048'>#</a></div><div class='texpara'><div id='qty.spec.conv-1.sentence-1' class='sentence'><i >Returns</i>: TBD<a class='hidden_link' href='#qty.spec.conv-1.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:QuantitySpec,explicitly_convertible'><div id='lib:explicitly_convertible,QuantitySpec'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:explicitly_convertible,QuantitySpec'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <span class='keyword'>bool</span> explicitly_convertible<span class='parenthesis'>(</span>QuantitySpec <span class='keyword'>auto</span> from, QuantitySpec <span class='keyword'>auto</span> to<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.spec.conv-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.spec.conv-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2059'>#</a></div><div class='texpara'><div id='qty.spec.conv-2.sentence-1' class='sentence'><i >Returns</i>: TBD<a class='hidden_link' href='#qty.spec.conv-2.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:QuantitySpec,castable'><div id='lib:castable,QuantitySpec'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:castable,QuantitySpec'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <span class='keyword'>bool</span> castable<span class='parenthesis'>(</span>QuantitySpec <span class='keyword'>auto</span> from, QuantitySpec <span class='keyword'>auto</span> to<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.spec.conv-3'><div class='marginalizedparent'><a class='marginalized' href='#qty.spec.conv-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2070'>#</a></div><div class='texpara'><div id='qty.spec.conv-3.sentence-1' class='sentence'><i >Returns</i>: TBD<a class='hidden_link' href='#qty.spec.conv-3.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:QuantitySpec,interconvertible'><div id='lib:interconvertible,QuantitySpec'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:interconvertible,QuantitySpec'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <span class='keyword'>bool</span> interconvertible<span class='parenthesis'>(</span>QuantitySpec <span class='keyword'>auto</span> qs1, QuantitySpec <span class='keyword'>auto</span> qs2<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.spec.conv-4'><div class='marginalizedparent'><a class='marginalized' href='#qty.spec.conv-4'>4</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2081'>#</a></div><div class='texpara'><div id='qty.spec.conv-4.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>implicitly_<span class='shy'></span>convertible<span class='parenthesis'>(</span>qs1, qs2<span class='parenthesis'>)</span> <span class='operator'>&</span><span class='operator'>&</span> implicitly_<span class='shy'></span>convertible<span class='parenthesis'>(</span>qs2, qs1<span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.spec.conv-4.sentence-1'>.</a></div></div></div></div></div><div id='qty.get.kind' class='section'><h4 ><a class='secnum' href='#qty.get.kind' style='min-width:110pt'>5.4.3.6.2</a> Get kind <a class='abbr_ref' href='qty.get.kind.html'>[qty.get.kind]</a></h4><div class='texpara'><div id='lib:get-kind-tree-root,QuantitySpec'><div id='lib:QuantitySpec,get-kind-tree-root'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:QuantitySpec,get-kind-tree-root'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec____________________________________________'><span class='texttt'>QuantitySpec</span></span></a> Q<span class='anglebracket'>></span>
|
||
<span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_____________________________________________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> <span class='texttt'><i >get-kind-tree-root</i></span><span class='parenthesis'>(</span>Q q<span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
</code></div></div></div></div><div class='para' id='qty.get.kind-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.get.kind-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2095'>#</a></div><div class='texpara'><div id='qty.get.kind-1.sentence-1' class='sentence'><i >Returns</i>: <ul class='itemize'><li id='qty.get.kind-1.1'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.get.kind-1.1'>(1.1)</a></div><div class='texpara'><div id='qty.get.kind-1.1.sentence-1' class='sentence'>If <span class='texttt'><a class='index' id='conceptref:QuantityKindSpec______'></a><span class='texttt'><i >QuantityKindSpec</i></span><span class='anglebracket'><</span>Q<span class='anglebracket'>></span></span> is <span class='texttt'><span class='literal'>true</span></span>,
|
||
returns <span class='texttt'><span class='texttt'><i >remove-kind</i></span><span class='parenthesis'>(</span>q<span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.get.kind-1.1.sentence-1'>.</a></div></div></li><li id='qty.get.kind-1.2'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.get.kind-1.2'>(1.2)</a></div><div class='texpara'><div id='qty.get.kind-1.2.sentence-1' class='sentence'>Otherwise, if
|
||
<span class='texttt'><span class='texttt'><i >is-derived-from-specialization-of</i></span><span class='anglebracket'><</span>Q, quantity_<span class='shy'></span>spec<span class='anglebracket'>></span><span class='parenthesis'>(</span><span class='parenthesis'>)</span></span>
|
||
is <span class='texttt'><span class='literal'>true</span></span>, and
|
||
the specialization of <span class='texttt'>Q<span class='operator'>​::​</span>quantity_<span class='shy'></span>spec</span> has a template argument equal to <span class='texttt'>is_<span class='shy'></span>kind</span>,
|
||
returns <span class='texttt'>q</span><a class='hidden_link' href='#qty.get.kind-1.2.sentence-1'>.</a></div></div></li><li id='qty.get.kind-1.3'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.get.kind-1.3'>(1.3)</a></div><div class='texpara'><div id='qty.get.kind-1.3.sentence-1' class='sentence'>Otherwise, if <span class='texttt'>Q<span class='operator'>​::​</span><span class='texttt'><i >parent</i></span></span> is a valid expression,
|
||
returns <span class='texttt'><span class='texttt'><i >get-kind-tree-root</i></span><span class='parenthesis'>(</span>Q<span class='operator'>​::​</span><span class='texttt'><i >parent</i></span><span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.get.kind-1.3.sentence-1'>.</a></div></div></li><li id='qty.get.kind-1.4'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.get.kind-1.4'>(1.4)</a></div><div class='texpara'><div id='qty.get.kind-1.4.sentence-1' class='sentence'>Otherwise, if <span class='texttt'><a class='index' id='conceptref:DerivedQuantitySpec__'></a><span class='texttt'><i >DerivedQuantitySpec</i></span><span class='anglebracket'><</span>Q<span class='anglebracket'>></span></span> is <span class='texttt'><span class='literal'>true</span></span>,
|
||
returns
|
||
<span class='codeblock'><i >expr-map</i><span class='anglebracket'><</span><i >to-kind</i>, derived_quantity_spec, <span class='keyword'>struct</span> dimensionless<span class='anglebracket'>></span><span class='parenthesis'>(</span>q<span class='parenthesis'>)</span>
|
||
</span>
|
||
where <span class='texttt'><i >to-kind</i></span> is defined as follows:
|
||
<span class='codeblock'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec______________________________________________'><span class='tcode_in_codeblock'>QuantitySpec</span></span></a> Q<span class='anglebracket'>></span>
|
||
<span class='keyword'>using</span> <i >to-kind</i> <span class='operator'>=</span> <span class='keyword'>decltype</span><span class='parenthesis'>(</span><i >get-kind-tree-root</i><span class='parenthesis'>(</span>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
</span></div></div></li><li id='qty.get.kind-1.5'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.get.kind-1.5'>(1.5)</a></div><div class='texpara'><div id='qty.get.kind-1.5.sentence-1' class='sentence'>Otherwise, returns <span class='texttt'>q</span><a class='hidden_link' href='#qty.get.kind-1.5.sentence-1'>.</a></div></div></li></ul></div></div></div></div><div class='texpara'><div id='lib:QuantitySpec,get_kind'><div id='lib:get_kind,QuantitySpec'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:get_kind,QuantitySpec'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_______________________________________________'><span class='texttt'>QuantitySpec</span></span></a> Q<span class='anglebracket'>></span>
|
||
<span class='keyword'>consteval</span> <a class='index' id='conceptref:QuantityKindSpec_______'></a><span class='texttt'><i >QuantityKindSpec</i></span> <span class='keyword'>auto</span> get_kind<span class='parenthesis'>(</span>Q<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.get.kind-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.get.kind-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2133'>#</a></div><div class='texpara'><div id='qty.get.kind-2.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>kind_<span class='shy'></span>of<span class='anglebracket'><</span><span class='texttt'><i >get-kind-tree-root</i></span><span class='parenthesis'>(</span>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='anglebracket'>></span></span><a class='hidden_link' href='#qty.get.kind-2.sentence-1'>.</a></div></div></div></div></div><div id='get.common.qty.spec' class='section'><h4 ><a class='secnum' href='#get.common.qty.spec' style='min-width:110pt'>5.4.3.6.3</a> Get common quantity specification <a class='abbr_ref' href='get.common.qty.spec.html'>[get.common.qty.spec]</a></h4><div class='texpara'><div id='lib:QuantitySpec,get_common_quantity_spec'><div id='lib:get_common_quantity_spec,QuantitySpec'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:get_common_quantity_spec,QuantitySpec'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec________________________________________________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> get_common_quantity_spec<span class='parenthesis'>(</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_________________________________________________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> qs<span class='parenthesis'>)</span>
|
||
<span class='keyword'>requires</span> <i ><span class='texttt'>see below</span></i>;
|
||
</code></div></div></div></div><div class='para' id='get.common.qty.spec-1'><div class='marginalizedparent'><a class='marginalized' href='#get.common.qty.spec-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2147'>#</a></div><div class='texpara'><div id='get.common.qty.spec-1.sentence-1' class='sentence'>Let
|
||
<ul class='itemize'><li id='get.common.qty.spec-1.1'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#get.common.qty.spec-1.1'>(1.1)</a></div><span class='texttt'>q1</span> be <span class='texttt'>qs<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='squarebracket'>[</span><span class='literal'>0</span><span class='squarebracket'>]</span></span>,</li><li id='get.common.qty.spec-1.2'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#get.common.qty.spec-1.2'>(1.2)</a></div><span class='texttt'>q2</span> be <span class='texttt'>qs<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='squarebracket'>[</span><span class='literal'>1</span><span class='squarebracket'>]</span></span>,</li><li id='get.common.qty.spec-1.3'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#get.common.qty.spec-1.3'>(1.3)</a></div><span class='texttt'>Q1</span> be <span class='texttt'><span class='keyword'>decltype</span><span class='parenthesis'>(</span>q1<span class='parenthesis'>)</span></span>,</li><li id='get.common.qty.spec-1.4'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#get.common.qty.spec-1.4'>(1.4)</a></div><span class='texttt'>Q2</span> be <span class='texttt'><span class='keyword'>decltype</span><span class='parenthesis'>(</span>q2<span class='parenthesis'>)</span></span>, and</li><li id='get.common.qty.spec-1.5'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#get.common.qty.spec-1.5'>(1.5)</a></div><span class='texttt'>rest</span> be a pack denoting the elements of <span class='texttt'>qs</span> without <span class='texttt'>q1</span> and <span class='texttt'>q2</span><a class='hidden_link' href='#get.common.qty.spec-1.sentence-1'>.</a></li></ul></div></div></div></div><div class='para' id='get.common.qty.spec-2'><div class='marginalizedparent'><a class='marginalized' href='#get.common.qty.spec-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2162'>#</a></div><div class='texpara'><div id='get.common.qty.spec-2.sentence-1' class='sentence'><i >Effects</i>: Equivalent to:
|
||
<span class='codeblock'><span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><span class='keyword'>sizeof</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>(</span>qs<span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> <span class='literal'>1</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> q1;
|
||
<span class='keyword'>else</span> <span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><span class='keyword'>sizeof</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>(</span>qs<span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> <span class='literal'>2</span><span class='parenthesis'>)</span> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>using</span> QQ1 <span class='operator'>=</span> <span class='keyword'>decltype</span><span class='parenthesis'>(</span><i >remove-kind</i><span class='parenthesis'>(</span>q1<span class='parenthesis'>)</span><span class='parenthesis'>)</span>;
|
||
<span class='keyword'>using</span> QQ2 <span class='operator'>=</span> <span class='keyword'>decltype</span><span class='parenthesis'>(</span><i >remove-kind</i><span class='parenthesis'>(</span>q2<span class='parenthesis'>)</span><span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span>std<span class='operator'>::</span>is_same_v<span class='anglebracket'><</span>Q1, Q2<span class='anglebracket'>></span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> q1;
|
||
<span class='keyword'>else</span> <span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><a class='index' id='conceptref:NestedQuantityKindSpecOf__'></a><i >NestedQuantityKindSpecOf</i><span class='anglebracket'><</span>Q1<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Q2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> QQ1<span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
<span class='keyword'>else</span> <span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><a class='index' id='conceptref:NestedQuantityKindSpecOf___'></a><i >NestedQuantityKindSpecOf</i><span class='anglebracket'><</span>Q2<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Q1<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> QQ2<span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
<span class='keyword'>else</span> <span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><span class='parenthesis'>(</span><a class='index' id='conceptref:QuantityKindSpec________'></a><i >QuantityKindSpec</i><span class='anglebracket'><</span>Q1<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <span class='operator'>!</span><a class='index' id='conceptref:QuantityKindSpec_________'></a><i >QuantityKindSpec</i><span class='anglebracket'><</span>Q2<span class='anglebracket'>></span><span class='parenthesis'>)</span> <span class='operator'>|</span><span class='operator'>|</span>
|
||
<span class='parenthesis'>(</span><a class='index' id='conceptref:DerivedQuantitySpec___'></a><i >DerivedQuantitySpec</i><span class='anglebracket'><</span>QQ1<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <a class='index' id='conceptref:NamedQuantitySpec___'></a><i >NamedQuantitySpec</i><span class='anglebracket'><</span>QQ2<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span>
|
||
implicitly_convertible<span class='parenthesis'>(</span>Q1<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Q2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> q2;
|
||
<span class='keyword'>else</span> <span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><span class='parenthesis'>(</span><span class='operator'>!</span><a class='index' id='conceptref:QuantityKindSpec__________'></a><i >QuantityKindSpec</i><span class='anglebracket'><</span>Q1<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <a class='index' id='conceptref:QuantityKindSpec___________'></a><i >QuantityKindSpec</i><span class='anglebracket'><</span>Q2<span class='anglebracket'>></span><span class='parenthesis'>)</span> <span class='operator'>|</span><span class='operator'>|</span>
|
||
<span class='parenthesis'>(</span><a class='index' id='conceptref:NamedQuantitySpec____'></a><i >NamedQuantitySpec</i><span class='anglebracket'><</span>QQ1<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <a class='index' id='conceptref:DerivedQuantitySpec____'></a><i >DerivedQuantitySpec</i><span class='anglebracket'><</span>QQ2<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span>
|
||
implicitly_convertible<span class='parenthesis'>(</span>Q2<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Q1<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> q1;
|
||
<span class='keyword'>else</span> <span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><span class='keyword'>constexpr</span> <span class='keyword'>auto</span> common_base <span class='operator'>=</span> <i >get-common-base</i><span class='anglebracket'><</span>Q1<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Q2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span><span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> <span class='operator'>*</span>common_base;
|
||
<span class='keyword'>else</span> <span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span>implicitly_convertible<span class='parenthesis'>(</span>Q1<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Q2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> q2;
|
||
<span class='keyword'>else</span> <span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span>implicitly_convertible<span class='parenthesis'>(</span>Q2<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Q1<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> q1;
|
||
<span class='keyword'>else</span> <span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span>implicitly_convertible<span class='parenthesis'>(</span><i >get-kind-tree-root</i><span class='parenthesis'>(</span>Q1<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>,
|
||
<i >get-kind-tree-root</i><span class='parenthesis'>(</span>Q2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> <i >get-kind-tree-root</i><span class='parenthesis'>(</span>q2<span class='parenthesis'>)</span>;
|
||
<span class='keyword'>else</span>
|
||
<span class='keyword'>return</span> <i >get-kind-tree-root</i><span class='parenthesis'>(</span>q1<span class='parenthesis'>)</span>;
|
||
<span class='curlybracket'>}</span> <span class='keyword'>else</span>
|
||
<span class='keyword'>return</span> get_common_quantity_spec<span class='parenthesis'>(</span>get_common_quantity_spec<span class='parenthesis'>(</span>q1, q2<span class='parenthesis'>)</span>, rest<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>)</span>;
|
||
</span></div></div></div></div><div class='para' id='get.common.qty.spec-3'><div class='marginalizedparent'><a class='marginalized' href='#get.common.qty.spec-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2201'>#</a></div><div class='texpara'><div id='get.common.qty.spec-3.sentence-1' class='sentence'><i >Remarks</i>: The expression in the <span class='textsf'><i >requires-clause</i></span> is equivalent to:
|
||
<span class='codeblock'><span class='parenthesis'>(</span><span class='keyword'>sizeof</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>(</span>qs<span class='parenthesis'>)</span> <span class='operator'>!</span><span class='operator'>=</span> <span class='literal'>0</span> <span class='operator'>&</span><span class='operator'>&</span>
|
||
<span class='parenthesis'>(</span><span class='keyword'>sizeof</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>(</span>qs<span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> <span class='literal'>1</span> <span class='operator'>|</span><span class='operator'>|</span>
|
||
<span class='parenthesis'>(</span><span class='keyword'>sizeof</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>(</span>qs<span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> <span class='literal'>2</span> <span class='operator'>&</span><span class='operator'>&</span>
|
||
<span class='parenthesis'>(</span><a class='index' id='conceptref:QuantitySpecConvertibleTo_'></a><i >QuantitySpecConvertibleTo</i><span class='anglebracket'><</span><i >get-kind-tree-root</i><span class='parenthesis'>(</span>Q1<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>, <i >get-kind-tree-root</i><span class='parenthesis'>(</span>Q2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='anglebracket'>></span> <span class='operator'>|</span><span class='operator'>|</span>
|
||
<a class='index' id='conceptref:QuantitySpecConvertibleTo__'></a><i >QuantitySpecConvertibleTo</i><span class='anglebracket'><</span><i >get-kind-tree-root</i><span class='parenthesis'>(</span>Q2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>, <i >get-kind-tree-root</i><span class='parenthesis'>(</span>Q1<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='anglebracket'>></span><span class='parenthesis'>)</span><span class='parenthesis'>)</span> <span class='operator'>|</span><span class='operator'>|</span>
|
||
<span class='keyword'>requires</span> <span class='curlybracket'>{</span> get_common_quantity_spec<span class='parenthesis'>(</span>get_common_quantity_spec<span class='parenthesis'>(</span>q1, q2<span class='parenthesis'>)</span>, rest<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>)</span>; <span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
</span></div></div></div></div></div><div id='qty.get.common.base' class='section'><h4 ><a class='secnum' href='#qty.get.common.base' style='min-width:110pt'>5.4.3.6.4</a> Get common base <a class='abbr_ref' href='qty.get.common.base.html'>[qty.get.common.base]</a></h4><div class='para' id='qty.get.common.base-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.get.common.base-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2216'>#</a></div><div class='texpara'><div id='qty.get.common.base-1.sentence-1' class='sentence'>In this subclause and <a href='#qty.is.child.of' title='5.4.3.6.5 Is child of'>[qty.<span class='shy'></span>is.<span class='shy'></span>child.<span class='shy'></span>of]</a>,
|
||
let the kind of quantity (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-04">IEC 60050, 112-01-04</a>) hierarchy of <span class='texttt'>q</span> be the tuple
|
||
<span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.446em; padding-bottom: 0.298em;">h</span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">(</span></span><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-type-R" style="padding-top: 0.225em; padding-bottom: 0.519em;">q</span></span></span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">)</span></span><span class="mjx-mo MJXc-space3"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.077em; padding-bottom: 0.298em;">=</span></span><span class="mjx-mo MJXc-space3"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">(</span></span><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-type-R" style="padding-top: 0.225em; padding-bottom: 0.519em;">q</span></span></span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><span class="mjx-texatom MJXc-space1"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-type-R" style="padding-top: 0.225em; padding-bottom: 0.519em;">q<span class='operator'>.</span>par</span></span></span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><span class="mjx-texatom MJXc-space1"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-type-R" style="padding-top: 0.225em; padding-bottom: 0.519em;">q<span class='operator'>.</span>par<span class='operator'>.</span>par</span></span></span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><span class="mjx-mo MJXc-space1"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.372em;">…</span></span><span class="mjx-texatom MJXc-space1"><span class="mjx-mrow"></span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">)</span></span></span></span></span>,
|
||
where <span class='texttt'>par</span> is <span class='texttt'><i >parent</i></span><a class='hidden_link' href='#qty.get.common.base-1.sentence-1'>.</a></div></div></div><div class='texpara'><div id='lib:get-common-base,QuantitySpec'><div id='lib:QuantitySpec,get-common-base'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:QuantitySpec,get-common-base'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec__________________________________________________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> A, <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec___________________________________________________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> B<span class='anglebracket'>></span>
|
||
<span class='keyword'>consteval</span> <span class='keyword'>auto</span> <span class='texttt'><i >get-common-base</i></span><span class='parenthesis'>(</span><span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
</code></div></div></div></div><div class='para' id='qty.get.common.base-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.get.common.base-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2229'>#</a></div><div class='texpara'><div id='qty.get.common.base-2.sentence-1' class='sentence'>Let
|
||
<ul class='itemize'><li id='qty.get.common.base-2.1'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.get.common.base-2.1'>(2.1)</a></div><span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-msubsup"><span class="mjx-base"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.225em; padding-bottom: 0.298em;">a</span></span></span><span class="mjx-sub" style="font-size: 70.7%; vertical-align: -0.212em; padding-right: 0.071em;"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.225em; padding-bottom: 0.298em;">s</span></span></span></span></span></span></span> be the number of elements in <span class='math'><span class='mathalpha'>h</span>(<span class='texttt'>A</span>)</span>,</li><li id='qty.get.common.base-2.2'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.get.common.base-2.2'>(2.2)</a></div><span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-msubsup"><span class="mjx-base"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.446em; padding-bottom: 0.298em;">b</span></span></span><span class="mjx-sub" style="font-size: 70.7%; vertical-align: -0.212em; padding-right: 0.071em;"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.225em; padding-bottom: 0.298em;">s</span></span></span></span></span></span></span> be the number of elements in <span class='math'><span class='mathalpha'>h</span>(<span class='texttt'>B</span>)</span>,</li><li id='qty.get.common.base-2.3'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.get.common.base-2.3'>(2.3)</a></div><span class='math'><span class='mathalpha'>s</span></span> be <span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">min</span></span><span class="mjx-mo"><span class="mjx-char"></span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">(</span></span><span class="mjx-msubsup"><span class="mjx-base"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.225em; padding-bottom: 0.298em;">a</span></span></span><span class="mjx-sub" style="font-size: 70.7%; vertical-align: -0.212em; padding-right: 0.071em;"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.225em; padding-bottom: 0.298em;">s</span></span></span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><span class="mjx-msubsup MJXc-space1"><span class="mjx-base"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.446em; padding-bottom: 0.298em;">b</span></span></span><span class="mjx-sub" style="font-size: 70.7%; vertical-align: -0.212em; padding-right: 0.071em;"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.225em; padding-bottom: 0.298em;">s</span></span></span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">)</span></span></span></span></span>,</li><li id='qty.get.common.base-2.4'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.get.common.base-2.4'>(2.4)</a></div><span class='math'><span class='mathalpha'>A</span></span> be a tuple of the last <span class='math'><span class='mathalpha'>s</span></span> elements of <span class='math'><span class='mathalpha'>h</span>(<span class='texttt'>A</span>)</span>, and</li><li id='qty.get.common.base-2.5'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.get.common.base-2.5'>(2.5)</a></div><span class='math'><span class='mathalpha'>B</span></span> be a tuple of the last <span class='math'><span class='mathalpha'>s</span></span> elements of <span class='math'><span class='mathalpha'>h</span>(<span class='texttt'>B</span>)</span><a class='hidden_link' href='#qty.get.common.base-2.sentence-1'>.</a></li></ul></div></div></div></div><div class='para' id='qty.get.common.base-3'><div class='marginalizedparent'><a class='marginalized' href='#qty.get.common.base-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2244'>#</a></div><div class='texpara'><div id='qty.get.common.base-3.sentence-1' class='sentence'><i >Effects</i>: Looks for <span class='math'><span class='mathalpha'>x</span></span>, the first pair-wise equal element in <span class='math'><span class='mathalpha'>A</span></span> and <span class='math'><span class='mathalpha'>B</span></span><a class='hidden_link' href='#qty.get.common.base-3.sentence-1'>.</a></div></div></div></div><div class='para' id='qty.get.common.base-4'><div class='marginalizedparent'><a class='marginalized' href='#qty.get.common.base-4'>4</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2248'>#</a></div><div class='texpara'><div id='qty.get.common.base-4.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>std<span class='operator'>​::​</span>optional<span class='parenthesis'>(</span><span class='math'><span class='mathalpha'>x</span></span><span class='parenthesis'>)</span></span>, if <span class='math'><span class='mathalpha'>x</span></span> is found, and <span class='texttt'>std<span class='operator'>​::​</span>optional<span class='anglebracket'><</span><i ><span class='texttt'>unspecified</span></i><span class='anglebracket'>></span><span class='parenthesis'>(</span><span class='parenthesis'>)</span></span> otherwise<a class='hidden_link' href='#qty.get.common.base-4.sentence-1'>.</a></div></div></div></div></div><div id='qty.is.child.of' class='section'><h4 ><a class='secnum' href='#qty.is.child.of' style='min-width:110pt'>5.4.3.6.5</a> Is child of <a class='abbr_ref' href='qty.is.child.of.html'>[qty.is.child.of]</a></h4><div class='texpara'><div id='lib:is-child-of,QuantitySpec'><div id='lib:QuantitySpec,is-child-of'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:QuantitySpec,is-child-of'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec____________________________________________________'><span class='texttt'>QuantitySpec</span></span></a> Child, <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_____________________________________________________'><span class='texttt'>QuantitySpec</span></span></a> Parent<span class='anglebracket'>></span>
|
||
<span class='keyword'>consteval</span> <span class='keyword'>bool</span> <span class='texttt'><i >is-child-of</i></span><span class='parenthesis'>(</span>Child ch, Parent p<span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
</code></div></div></div></div><div class='para' id='qty.is.child.of-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.is.child.of-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2262'>#</a></div><div class='texpara'><div id='qty.is.child.of-1.sentence-1' class='sentence'><i >Returns</i>: If <span class='math'><span class='mathalpha'>h</span>(<span class='texttt'>p</span>)</span> has more elements than <span class='math'><span class='mathalpha'>h</span>(<span class='texttt'>ch</span>)</span>, returns <span class='texttt'><span class='literal'>false</span></span><a class='hidden_link' href='#qty.is.child.of-1.sentence-1'>.</a></div> <div id='qty.is.child.of-1.sentence-2' class='sentence'>Otherwise, let <span class='math'><span class='mathalpha'>C</span></span> be a tuple of the last <span class='math'><span class='mathalpha'>s</span></span> elements of <span class='math'><span class='mathalpha'>h</span>(<span class='texttt'>ch</span>)</span>,
|
||
where <span class='math'><span class='mathalpha'>s</span></span> is the number of elements in <span class='math'><span class='mathalpha'>h</span>(<span class='texttt'>p</span>)</span><a class='hidden_link' href='#qty.is.child.of-1.sentence-2'>.</a></div> <div id='qty.is.child.of-1.sentence-3' class='sentence'>Returns <span class='texttt'><span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-msubsup"><span class="mjx-base" style="margin-right: -0.045em;"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.519em; padding-bottom: 0.298em; padding-right: 0.045em;">C</span></span></span><span class="mjx-sub" style="font-size: 70.7%; vertical-align: -0.212em; padding-right: 0.071em;"><span class="mjx-mn"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">0</span></span></span></span></span></span></span> <span class='operator'>=</span><span class='operator'>=</span> p</span><a class='hidden_link' href='#qty.is.child.of-1.sentence-3'>.</a></div></div></div></div></div></div></div><div id='qty.unit' class='section'><h3 ><a class='secnum' href='#qty.unit' style='min-width:80pt'>5.4.4</a> Unit <a class='abbr_ref' href='qty.unit.html'>[qty.unit]</a></h3><div id='qty.unit.general' class='section'><h4 ><a class='secnum' href='#qty.unit.general' style='min-width:95pt'>5.4.4.1</a> General <a class='abbr_ref' href='qty.unit.general.html'>[qty.unit.general]</a></h4><div class='para' id='qty.unit.general-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.general-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2274'>#</a></div><div class='texpara'><div id='qty.unit.general-1.sentence-1' class='sentence'>Subclause <a href='#qty.unit' title='5.4.4 Unit'>[qty.<span class='shy'></span>unit]</a> specifies the components
|
||
for defining a unit of measurement (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-14">IEC 60050, 112-01-14</a>)<a class='hidden_link' href='#qty.unit.general-1.sentence-1'>.</a></div></div></div></div><div id='qty.unit.mag' class='section'><h4 ><a class='secnum' href='#qty.unit.mag' style='min-width:95pt'>5.4.4.2</a> Magnitude <a class='abbr_ref' href='qty.unit.mag.html'>[qty.unit.mag]</a></h4><div id='qty.unit.mag.general' class='section'><h4 ><a class='secnum' href='#qty.unit.mag.general' style='min-width:110pt'>5.4.4.2.1</a> General <a class='abbr_ref' href='qty.unit.mag.general.html'>[qty.unit.mag.general]</a></h4><div class='para' id='qty.unit.mag.general-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.mag.general-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2282'>#</a></div><div class='texpara'><div id='qty.unit.mag.general-1.sentence-1' class='sentence'>Subclause <a href='#qty.unit.mag' title='5.4.4.2 Magnitude'>[qty.<span class='shy'></span>unit.<span class='shy'></span>mag]</a> specifies the components
|
||
used to represent the numerical value (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-29">IEC 60050, 112-01-29</a>) of a unit
|
||
with support for powers (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=102-02-08">IEC 60050, 102-02-08</a>) of real numbers (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=102-02-05">IEC 60050, 102-02-05</a>)<a class='hidden_link' href='#qty.unit.mag.general-1.sentence-1'>.</a></div></div></div></div><div id='qty.unit.mag.concepts' class='section'><h4 ><a class='secnum' href='#qty.unit.mag.concepts' style='min-width:110pt'>5.4.4.2.2</a> Concepts <a class='abbr_ref' href='qty.unit.mag.concepts.html'>[qty.unit.mag.concepts]</a></h4><div class='texpara'><div class='itemdecl' id='qty.unit.mag.concepts-itemdecl:1'><div class='marginalizedparent'><a class='itemDeclLink' href='#qty.unit.mag.concepts-itemdecl:1'>🔗</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> <a class='hidden_link' href='#concept:MagConstant' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='concept:MagConstant'><span id='lib:MagConstant'><span class='texttt'>MagConstant</span></span></span></a> <span class='operator'>=</span> <a class='index' id='conceptref:SymbolicConstant____'></a><span class='texttt'><i >SymbolicConstant</i></span><span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <span class='texttt'><i >is-derived-from-specialization-of</i></span><span class='anglebracket'><</span>T, mag_constant<span class='anglebracket'>></span><span class='parenthesis'>(</span><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:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='concept:UnitMagnitude'><span id='lib:UnitMagnitude'><span class='texttt'>UnitMagnitude</span></span></span></a> <span class='operator'>=</span> <span class='parenthesis'>(</span><span class='texttt'><i >is-specialization-of</i></span><span class='anglebracket'><</span>T, <span class='texttt'><i >unit-magnitude</i></span><span class='anglebracket'>></span><span class='parenthesis'>(</span><span class='parenthesis'>)</span><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> <span class='texttt'><i >MagArg</i></span><a class='index' id='concept:MagArg'></a> <span class='operator'>=</span> std<span class='operator'>::</span>integral<span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>|</span><span class='operator'>|</span> <a href='#concept:MagConstant' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:MagConstant'><span class='texttt'>MagConstant</span></span></a><span class='anglebracket'><</span>T<span class='anglebracket'>></span>; <span class='comment'>// <i >exposition only</i></span>
|
||
</code></div></div></div><div id='qty.unit.mag.types' class='section'><h4 ><a class='secnum' href='#qty.unit.mag.types' style='min-width:110pt'>5.4.4.2.3</a> Types <a class='abbr_ref' href='qty.unit.mag.types.html'>[qty.unit.mag.types]</a></h4><div class='texpara'><span id='lib:mag_constant'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:mag_constant'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span>symbol_text Symbol, <span class='keyword'>long</span> <span class='keyword'>double</span> Value<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span>Value <span class='anglebracket'>></span> <span class='literal'>0</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>struct</span> mag_constant <span class='curlybracket'>{</span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >symbol</i> <span class='operator'>=</span> Symbol; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>long</span> <span class='keyword'>double</span> <i >value</i> <span class='operator'>=</span> Value; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></div><div class='texpara'><div id='qty.unit.mag.types-sentence-1' class='sentence'>A specialization of <span class='texttt'>mag_<span class='shy'></span>constant</span> represents a real number (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=102-02-05">IEC 60050, 102-02-05</a>)<a class='hidden_link' href='#qty.unit.mag.types-sentence-1'>.</a></div> <div id='qty.unit.mag.types-sentence-2' class='sentence'><span class='texttt'>Symbol</span> is its symbol, and
|
||
<span class='texttt'>Value</span> is (an approximation of) its value<a class='hidden_link' href='#qty.unit.mag.types-sentence-2'>.</a></div></div><div class='texpara'><span id='lib:unit-magnitude'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:unit-magnitude'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</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> Ms<span class='anglebracket'>></span>
|
||
<span class='keyword'>struct</span> <i >unit-magnitude</i> <span class='curlybracket'>{</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='comment'>// <a href='#qty.unit.mag.ops' title='5.4.4.2.4 Operations'>[qty.<span class='shy'></span>unit.<span class='shy'></span>mag.<span class='shy'></span>ops]</a>, operations</span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude'><span class='tcode_in_codeblock'>UnitMagnitude</span></span></a> M<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude_'><span class='tcode_in_codeblock'>UnitMagnitude</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span><i >unit-magnitude</i> lhs, M rhs<span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>/</span><span class='parenthesis'>(</span><i >unit-magnitude</i> lhs, <a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude__'><span class='tcode_in_codeblock'>UnitMagnitude</span></span></a> <span class='keyword'>auto</span> rhs<span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude___'><span class='tcode_in_codeblock'>UnitMagnitude</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> <span class='keyword'>operator</span><span class='operator'>=</span><span class='operator'>=</span><span class='parenthesis'>(</span><i >unit-magnitude</i>, Rhs<span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>int</span> Num, <span class='keyword'>int</span> Den <span class='operator'>=</span> <span class='literal'>1</span><span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>auto</span> <i >pow</i><span class='parenthesis'>(</span><i >unit-magnitude</i><span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
|
||
<span class='comment'>// <a href='#qty.unit.mag.utils' title='5.4.4.2.5 Utilities'>[qty.<span class='shy'></span>unit.<span class='shy'></span>mag.<span class='shy'></span>utils]</a>, utilities</span>
|
||
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> <i >is-positive-integral-power</i><span class='parenthesis'>(</span><i >unit-magnitude</i><span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></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> Ms2<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>auto</span> <i >common-magnitude</i><span class='parenthesis'>(</span><i >unit-magnitude</i>, <span class='comment'>// <i >exposition only</i></span>
|
||
<i >unit-magnitude</i><span class='anglebracket'><</span>Ms2<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>></span><span class='parenthesis'>)</span>;
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></div><div class='para' id='qty.unit.mag.types-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.mag.types-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2351'>#</a></div><div class='texpara'><div id='qty.unit.mag.types-1.sentence-1' class='sentence'>A specialization of <span class='texttt'><i >unit-magnitude</i></span>
|
||
represents the product of its template arguments<a class='hidden_link' href='#qty.unit.mag.types-1.sentence-1'>.</a></div></div></div><div class='para' id='qty.unit.mag.types-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.mag.types-2'>2</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2355'>#</a></div><div class='texpara'><div id='qty.unit.mag.types-2.sentence-1' class='sentence'>For the purposes of specifying the implementation-defined limits,
|
||
let the representation of the terms of <span class='texttt'><i >unit-magnitude</i></span> be the structure
|
||
<span class='codeblock'><span class='keyword'>struct</span> <span class='curlybracket'>{</span>
|
||
<i >ratio</i> exp;
|
||
<i >base-type</i> base;
|
||
<span class='curlybracket'>}</span>;
|
||
</span>
|
||
representing the number <span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-msubsup"><span class="mjx-base"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-type-R" style="padding-top: 0.372em; padding-bottom: 0.298em;">base</span></span></span></span></span><span class="mjx-sup" style="font-size: 70.7%; vertical-align: 0.513em; padding-left: 0px; padding-right: 0.071em;"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-type-R" style="padding-top: 0.225em; padding-bottom: 0.519em;">exp</span></span></span></span></span></span></span></span></span>,
|
||
where <span class='texttt'><i >base-type</i></span> is a model of <a href='#concept:MagArg' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:MagArg'><span class='texttt'><i >MagArg</i></span></span></a><a class='hidden_link' href='#qty.unit.mag.types-2.sentence-1'>.</a></div> <ul class='itemize'><li id='qty.unit.mag.types-2.1'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#qty.unit.mag.types-2.1'>(2.1)</a></div><div class='texpara'><div id='qty.unit.mag.types-2.1.sentence-1' class='sentence'>There is a single term for each <span class='texttt'><i >base-type</i></span><a class='hidden_link' href='#qty.unit.mag.types-2.1.sentence-1'>.</a></div></div></li><li id='qty.unit.mag.types-2.2'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#qty.unit.mag.types-2.2'>(2.2)</a></div><div class='texpara'><div id='qty.unit.mag.types-2.2.sentence-1' class='sentence'><span class='texttt'>exp<span class='operator'>.</span>num</span> is not expanded into base<a class='hidden_link' href='#qty.unit.mag.types-2.2.sentence-1'>.</a></div> <div id='qty.unit.mag.types-note-1' class='note'><div class='texpara'>[<i>Note <a href='#qty.unit.mag.types-note-1'>1</a></i>: <div id='qty.unit.mag.types-2.2.sentence-2' class='sentence'><span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-msubsup"><span class="mjx-base"><span class="mjx-mn"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">2</span></span></span><span class="mjx-sup" style="font-size: 70.7%; vertical-align: 0.591em; padding-left: 0px; padding-right: 0.071em;"><span class="mjx-mn"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">3</span></span></span></span><span class="mjx-mo MJXc-space3"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.077em; padding-bottom: 0.298em;">=</span></span><span class="mjx-mn MJXc-space3"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">8</span></span></span></span></span> is not permitted<a class='hidden_link' href='#qty.unit.mag.types-2.2.sentence-2'>.</a></div> — <i>end note</i>]</div></div></div></li><li id='qty.unit.mag.types-2.3'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#qty.unit.mag.types-2.3'>(2.3)</a></div><div class='texpara'><div id='qty.unit.mag.types-2.3.sentence-1' class='sentence'><span class='texttt'>exp<span class='operator'>.</span>den</span> can reduce the base<a class='hidden_link' href='#qty.unit.mag.types-2.3.sentence-1'>.</a></div> <div id='qty.unit.mag.types-note-2' class='note'><div class='texpara'>[<i>Note <a href='#qty.unit.mag.types-note-2'>2</a></i>: <div id='qty.unit.mag.types-2.3.sentence-2' class='sentence'><span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-msubsup"><span class="mjx-base"><span class="mjx-mn"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">4</span></span></span><span class="mjx-sup" style="font-size: 70.7%; vertical-align: 0.607em; padding-left: 0px; padding-right: 0.071em;"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mn"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">1</span></span><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">/</span></span></span></span><span class="mjx-mn"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">2</span></span></span></span></span></span><span class="mjx-mo MJXc-space3"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.077em; padding-bottom: 0.298em;">=</span></span><span class="mjx-mn MJXc-space3"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">2</span></span></span></span></span> is permitted<a class='hidden_link' href='#qty.unit.mag.types-2.3.sentence-2'>.</a></div> — <i>end note</i>]</div></div></div></li><li id='qty.unit.mag.types-2.4'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#qty.unit.mag.types-2.4'>(2.4)</a></div><div class='texpara'><div id='qty.unit.mag.types-2.4.sentence-1' class='sentence'>If the result of an operation on <span class='texttt'>std<span class='operator'>​::​</span>intmax_<span class='shy'></span>t</span> values is undefined,
|
||
the behavior is
|
||
<a class='index' id=':behavior_of_unit-magnitude_operations_that_do_not_fit_in_a_std::intmax_t'></a>implementation-defined<a class='hidden_link' href='#qty.unit.mag.types-2.4.sentence-1'>.</a></div></div></li></ul></div></div></div><div id='qty.unit.mag.ops' class='section'><h4 ><a class='secnum' href='#qty.unit.mag.ops' style='min-width:110pt'>5.4.4.2.4</a> Operations <a class='abbr_ref' href='qty.unit.mag.ops.html'>[qty.unit.mag.ops]</a></h4><div class='texpara'><div id='lib:UnitMagnitude,operator*'><div id='lib:operator*,UnitMagnitude'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator*,UnitMagnitude'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude____'><span class='texttt'>UnitMagnitude</span></span></a> M<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude_____'><span class='texttt'>UnitMagnitude</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span><span class='texttt'><i >unit-magnitude</i></span> lhs, M rhs<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.mag.ops-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.mag.ops-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2394'>#</a></div><div class='texpara'><div id='qty.unit.mag.ops-1.sentence-1' class='sentence'><i >Returns</i>: <ul class='itemize'><li id='qty.unit.mag.ops-1.1'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.unit.mag.ops-1.1'>(1.1)</a></div><div class='texpara'><div id='qty.unit.mag.ops-1.1.sentence-1' class='sentence'>If <span class='texttt'><span class='keyword'>sizeof</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>(</span>Ms<span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> <span class='literal'>0</span></span> is <span class='texttt'><span class='literal'>true</span></span>, returns <span class='texttt'>rhs</span><a class='hidden_link' href='#qty.unit.mag.ops-1.1.sentence-1'>.</a></div></div></li><li id='qty.unit.mag.ops-1.2'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.unit.mag.ops-1.2'>(1.2)</a></div><div class='texpara'><div id='qty.unit.mag.ops-1.2.sentence-1' class='sentence'>Otherwise, if <span class='texttt'>std<span class='operator'>​::​</span>is_<span class='shy'></span>same_<span class='shy'></span>v<span class='anglebracket'><</span>M, <span class='texttt'><i >unit-magnitude</i></span><span class='anglebracket'><</span><span class='anglebracket'>></span><span class='anglebracket'>></span></span>, returns <span class='texttt'>lhs</span><a class='hidden_link' href='#qty.unit.mag.ops-1.2.sentence-1'>.</a></div></div></li><li id='qty.unit.mag.ops-1.3'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.unit.mag.ops-1.3'>(1.3)</a></div><div class='texpara'><div id='qty.unit.mag.ops-1.3.sentence-1' class='sentence'>Otherwise, returns an unspecified value equal to <span class='math'><span class='texttt'>lhs</span> ×<span class='texttt'>rhs</span></span><a class='hidden_link' href='#qty.unit.mag.ops-1.3.sentence-1'>.</a></div></div></li></ul></div></div></div></div><div class='texpara'><div id='lib:UnitMagnitude,operator/'><div id='lib:operator/,UnitMagnitude'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator/,UnitMagnitude'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>/</span><span class='parenthesis'>(</span><span class='texttt'><i >unit-magnitude</i></span> lhs, <a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude______'><span class='texttt'>UnitMagnitude</span></span></a> <span class='keyword'>auto</span> rhs<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.mag.ops-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.mag.ops-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2412'>#</a></div><div class='texpara'><div id='qty.unit.mag.ops-2.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>lhs <span class='operator'>*</span> <span class='texttt'><i >pow</i></span><span class='anglebracket'><</span><span class='operator'>-</span><span class='literal'>1</span><span class='anglebracket'>></span><span class='parenthesis'>(</span>rhs<span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.unit.mag.ops-2.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:UnitMagnitude,operator=='><div id='lib:operator==,UnitMagnitude'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator==,UnitMagnitude'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude_______'><span class='texttt'>UnitMagnitude</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> <span class='keyword'>operator</span><span class='operator'>=</span><span class='operator'>=</span><span class='parenthesis'>(</span><span class='texttt'><i >unit-magnitude</i></span>, Rhs<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.mag.ops-3'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.mag.ops-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2424'>#</a></div><div class='texpara'><div id='qty.unit.mag.ops-3.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>std<span class='operator'>​::​</span>is_<span class='shy'></span>same_<span class='shy'></span>v<span class='anglebracket'><</span><span class='texttt'><i >unit-magnitude</i></span>, Rhs<span class='anglebracket'>></span></span><a class='hidden_link' href='#qty.unit.mag.ops-3.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:pow,UnitMagnitude'><div id='lib:UnitMagnitude,pow'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:UnitMagnitude,pow'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>int</span> Num, <span class='keyword'>int</span> Den <span class='operator'>=</span> <span class='literal'>1</span><span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>auto</span> <span class='texttt'><i >pow</i></span><span class='parenthesis'>(</span><span class='texttt'><i >unit-magnitude</i></span> base<span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
</code></div></div></div></div><div class='para' id='qty.unit.mag.ops-4'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.mag.ops-4'>4</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2436'>#</a></div><div class='texpara'><div id='qty.unit.mag.ops-4.sentence-1' class='sentence'><i >Returns</i>: <ul class='itemize'><li id='qty.unit.mag.ops-4.1'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.unit.mag.ops-4.1'>(4.1)</a></div><div class='texpara'><div id='qty.unit.mag.ops-4.1.sentence-1' class='sentence'>If <span class='texttt'>Num <span class='operator'>=</span><span class='operator'>=</span> <span class='literal'>0</span></span> is <span class='texttt'><span class='literal'>true</span></span>, returns <span class='texttt'><span class='texttt'><i >unit-magnitude</i></span><span class='anglebracket'><</span><span class='anglebracket'>></span><span class='curlybracket'>{</span><span class='curlybracket'>}</span></span><a class='hidden_link' href='#qty.unit.mag.ops-4.1.sentence-1'>.</a></div></div></li><li id='qty.unit.mag.ops-4.2'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.unit.mag.ops-4.2'>(4.2)</a></div><div class='texpara'><div id='qty.unit.mag.ops-4.2.sentence-1' class='sentence'>Otherwise, returns an unspecified value equal to <span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-msubsup"><span class="mjx-base"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-type-R" style="padding-top: 0.372em; padding-bottom: 0.298em;">base</span></span></span></span></span><span class="mjx-sup" style="font-size: 70.7%; vertical-align: 0.513em; padding-left: 0px; padding-right: 0.071em;"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-type-R" style="padding-top: 0.372em; padding-bottom: 0.298em;">Num</span></span></span></span><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">/</span></span></span></span><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-type-R" style="padding-top: 0.372em; padding-bottom: 0.298em;">Den</span></span></span></span></span></span></span></span></span></span></span><a class='hidden_link' href='#qty.unit.mag.ops-4.2.sentence-1'>.</a></div></div></li></ul></div></div></div></div><div class='texpara'><div id='lib:mag'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:mag'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a class='index' id='conceptref:MagArg_'></a><span class='texttt'><i >MagArg</i></span> <span class='keyword'>auto</span> V<span class='anglebracket'>></span>
|
||
<span class='keyword'>constexpr</span> <a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude________'><span class='texttt'>UnitMagnitude</span></span></a> <span class='keyword'>auto</span> mag <span class='operator'>=</span> <i ><span class='texttt'>see below</span></i>;
|
||
</code></div></div></div><div class='para' id='qty.unit.mag.ops-5'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.mag.ops-5'>5</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2453'>#</a></div><div class='texpara'><div id='qty.unit.mag.ops-5.sentence-1' class='sentence'><i >Constraints</i>: <span class='texttt'>V</span> is greater than <span class='math'>0</span><a class='hidden_link' href='#qty.unit.mag.ops-5.sentence-1'>.</a></div></div></div></div><div class='para' id='qty.unit.mag.ops-6'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.mag.ops-6'>6</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2457'>#</a></div><div class='texpara'><div id='qty.unit.mag.ops-6.sentence-1' class='sentence'><i >Effects</i>: If <span class='texttt'><a href='#concept:MagConstant' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:MagConstant_'><span class='texttt'>MagConstant</span></span></a><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>V<span class='parenthesis'>)</span><span class='anglebracket'>></span></span> is satisfied,
|
||
initializes <span class='texttt'>mag</span> with <span class='texttt'><span class='texttt'><i >unit-magnitude</i></span><span class='anglebracket'><</span>V<span class='anglebracket'>></span><span class='curlybracket'>{</span><span class='curlybracket'>}</span></span><a class='hidden_link' href='#qty.unit.mag.ops-6.sentence-1'>.</a></div> <div id='qty.unit.mag.ops-6.sentence-2' class='sentence'>Otherwise, initializes <span class='texttt'>mag</span> with
|
||
an unspecified value equal to <span class='texttt'>V</span><a class='hidden_link' href='#qty.unit.mag.ops-6.sentence-2'>.</a></div></div></div></div><div class='texpara'><div id='lib:mag_ratio'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:mag_ratio'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span>std<span class='operator'>::</span>intmax_t N, std<span class='operator'>::</span>intmax_t D<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span>N <span class='anglebracket'>></span> <span class='literal'>0</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>constexpr</span> <a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude_________'><span class='texttt'>UnitMagnitude</span></span></a> <span class='keyword'>auto</span> mag_ratio <span class='operator'>=</span> <i ><span class='texttt'>see below</span></i>;
|
||
</code></div></div></div><div class='para' id='qty.unit.mag.ops-7'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.mag.ops-7'>7</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2473'>#</a></div><div class='texpara'><div id='qty.unit.mag.ops-7.sentence-1' class='sentence'><i >Effects</i>: Initializes <span class='texttt'>mag_<span class='shy'></span>ratio</span> with
|
||
an unspecified value equal to <span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-type-R" style="padding-top: 0.372em; padding-bottom: 0.298em;">N</span></span></span></span><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">/</span></span></span></span><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-type-R" style="padding-top: 0.372em; padding-bottom: 0.225em;">D</span></span></span></span></span></span></span><a class='hidden_link' href='#qty.unit.mag.ops-7.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:mag_power'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:mag_power'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a class='index' id='conceptref:MagArg__'></a><span class='texttt'><i >MagArg</i></span> <span class='keyword'>auto</span> Base, <span class='keyword'>int</span> Num, <span class='keyword'>int</span> Den <span class='operator'>=</span> <span class='literal'>1</span><span class='anglebracket'>></span>
|
||
<span class='keyword'>constexpr</span> <a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude__________'><span class='texttt'>UnitMagnitude</span></span></a> <span class='keyword'>auto</span> mag_power <span class='operator'>=</span> <span class='texttt'><i >pow</i></span><span class='anglebracket'><</span>Num, Den<span class='anglebracket'>></span><span class='parenthesis'>(</span>mag<span class='anglebracket'><</span>Base<span class='anglebracket'>></span><span class='parenthesis'>)</span>;
|
||
</code></div></div></div><div class='para' id='qty.unit.mag.ops-8'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.mag.ops-8'>8</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2486'>#</a></div><div class='texpara'><div id='qty.unit.mag.ops-8.sentence-1' class='sentence'><i >Constraints</i>: <span class='texttt'>Base</span> is greater than <span class='math'>0</span><a class='hidden_link' href='#qty.unit.mag.ops-8.sentence-1'>.</a></div></div></div></div></div><div id='qty.unit.mag.utils' class='section'><h4 ><a class='secnum' href='#qty.unit.mag.utils' style='min-width:110pt'>5.4.4.2.5</a> Utilities <a class='abbr_ref' href='qty.unit.mag.utils.html'>[qty.unit.mag.utils]</a></h4><div class='texpara'><div id='lib:is-positive-integral-power,UnitMagnitude'><div id='lib:UnitMagnitude,is-positive-integral-power'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:UnitMagnitude,is-positive-integral-power'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> <span class='texttt'><i >is-positive-integral-power</i></span><span class='parenthesis'>(</span><span class='texttt'><i >unit-magnitude</i></span> x<span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
</code></div></div></div></div><div class='para' id='qty.unit.mag.utils-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.mag.utils-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2499'>#</a></div><div class='texpara'><div id='qty.unit.mag.utils-1.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'><span class='literal'>false</span></span> if <span class='texttt'>x</span> has a negative or rational exponent, and
|
||
<span class='texttt'><span class='literal'>true</span></span> otherwise<a class='hidden_link' href='#qty.unit.mag.utils-1.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:common-magnitude,UnitMagnitude'><div id='lib:UnitMagnitude,common-magnitude'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:UnitMagnitude,common-magnitude'>🔗</a></div><code class='itemdeclcode'><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> Ms2<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>auto</span> <span class='texttt'><i >common-magnitude</i></span><span class='parenthesis'>(</span><span class='texttt'><i >unit-magnitude</i></span>, <span class='texttt'><i >unit-magnitude</i></span><span class='anglebracket'><</span>Ms2<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>></span><span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
</code></div></div></div></div><div class='para' id='qty.unit.mag.utils-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.mag.utils-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2512'>#</a></div><div class='texpara'><div id='qty.unit.mag.utils-2.sentence-1' class='sentence'><i >Returns</i>: The largest magnitude <span class='texttt'>C</span>
|
||
such that each input magnitude is expressible
|
||
by only positive powers relative to <span class='texttt'>C</span><a class='hidden_link' href='#qty.unit.mag.utils-2.sentence-1'>.</a></div></div></div></div></div></div><div id='qty.unit.traits' class='section'><h4 ><a class='secnum' href='#qty.unit.traits' style='min-width:95pt'>5.4.4.3</a> Traits <a class='abbr_ref' href='qty.unit.traits.html'>[qty.unit.traits]</a></h4><div class='texpara'><div id='lib:space_before_unit_symbol'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:space_before_unit_symbol'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>constexpr</span> <span class='keyword'>bool</span> space_before_unit_symbol <span class='operator'>=</span> <span class='literal'>true</span>;
|
||
</code></div></div></div><div class='para' id='qty.unit.traits-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.traits-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2528'>#</a></div><div class='texpara'><div id='qty.unit.traits-1.sentence-1' class='sentence'>The formatting functions (<a href='#qty.unit.sym.fmt' title='5.4.4.10 Symbol formatting'>[qty.<span class='shy'></span>unit.<span class='shy'></span>sym.<span class='shy'></span>fmt]</a>) use <span class='texttt'>space_<span class='shy'></span>before_<span class='shy'></span>unit_<span class='shy'></span>symbol</span>
|
||
to determine whether there is a space
|
||
between the numerical value and the unit symbol<a class='hidden_link' href='#qty.unit.traits-1.sentence-1'>.</a></div></div></div></div><div class='para' id='qty.unit.traits-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.traits-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2533'>#</a></div><div class='texpara'><div id='qty.unit.traits-2.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'>space_<span class='shy'></span>before_<span class='shy'></span>unit_<span class='shy'></span>symbol</span>
|
||
for cv-unqualified program-defined types<a class='hidden_link' href='#qty.unit.traits-2.sentence-1'>.</a></div> <div id='qty.unit.traits-2.sentence-2' class='sentence'>Such specializations shall be usable in constant expressions (<a href="https://wg21.link/expr.const">N4971, [expr.const]</a>)
|
||
and have type <span class='texttt'><span class='keyword'>const</span> <span class='keyword'>bool</span></span><a class='hidden_link' href='#qty.unit.traits-2.sentence-2'>.</a></div></div></div></div></div><div id='qty.unit.concepts' class='section'><h4 ><a class='secnum' href='#qty.unit.concepts' style='min-width:95pt'>5.4.4.4</a> Concepts <a class='abbr_ref' href='qty.unit.concepts.html'>[qty.unit.concepts]</a></h4><div class='texpara'><div class='itemdecl' id='qty.unit.concepts-itemdecl:1'><div class='marginalizedparent'><a class='itemDeclLink' href='#qty.unit.concepts-itemdecl:1'>🔗</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> <a class='hidden_link' href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='concept:Unit'><span id='lib:Unit'><span class='texttt'>Unit</span></span></span></a> <span class='operator'>=</span> <a class='index' id='conceptref:SymbolicConstant_____'></a><span class='texttt'><i >SymbolicConstant</i></span><span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> std<span class='operator'>::</span>derived_from<span class='anglebracket'><</span>T, <span class='texttt'><i >unit-interface</i></span><span class='anglebracket'>></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:PrefixableUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='concept:PrefixableUnit'><span id='lib:PrefixableUnit'><span class='texttt'>PrefixableUnit</span></span></span></a> <span class='operator'>=</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit__'><span class='texttt'>Unit</span></span></a><span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <span class='texttt'><i >is-derived-from-specialization-of</i></span><span class='anglebracket'><</span>T, named_unit<span class='anglebracket'>></span><span class='parenthesis'>(</span><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:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='concept:AssociatedUnit'><span id='lib:AssociatedUnit'><span class='texttt'>AssociatedUnit</span></span></span></a> <span class='operator'>=</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit___'><span class='texttt'>Unit</span></span></a><span class='anglebracket'><</span>U<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <span class='texttt'><i >has-associated-quantity</i></span><span class='parenthesis'>(</span>U<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> U, <span class='keyword'>auto</span> QS<span class='anglebracket'>></span>
|
||
<span class='keyword'>concept</span> <a class='hidden_link' href='#concept:UnitOf' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='concept:UnitOf'><span id='lib:UnitOf'><span class='texttt'>UnitOf</span></span></span></a> <span class='operator'>=</span> <a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit_'><span class='texttt'>AssociatedUnit</span></span></a><span class='anglebracket'><</span>U<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec______________________________________________________'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>QS<span class='parenthesis'>)</span><span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span>
|
||
<a class='index' id='conceptref:QuantitySpecConvertibleTo___'></a><span class='texttt'><i >QuantitySpecConvertibleTo</i></span><span class='anglebracket'><</span>get_quantity_spec<span class='parenthesis'>(</span>U<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>, QS<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span>
|
||
<span class='parenthesis'>(</span>get_kind<span class='parenthesis'>(</span>QS<span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> get_kind<span class='parenthesis'>(</span>get_quantity_spec<span class='parenthesis'>(</span>U<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span> <span class='operator'>|</span><span class='operator'>|</span>
|
||
<span class='operator'>!</span><a class='index' id='conceptref:NestedQuantityKindSpecOf____'></a><span class='texttt'><i >NestedQuantityKindSpecOf</i></span><span class='anglebracket'><</span>get_quantity_spec<span class='parenthesis'>(</span>U<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>, QS<span class='anglebracket'>></span><span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>auto</span> From, <span class='keyword'>auto</span> To<span class='anglebracket'>></span>
|
||
<span class='keyword'>concept</span> <span class='texttt'><i >UnitConvertibleTo</i></span><a class='index' id='concept:UnitConvertibleTo'></a> <span class='operator'>=</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit____'><span class='texttt'>Unit</span></span></a><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>From<span class='parenthesis'>)</span><span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_____'><span class='texttt'>Unit</span></span></a><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>To<span class='parenthesis'>)</span><span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <span class='parenthesis'>(</span>convertible<span class='parenthesis'>(</span>From, To<span class='parenthesis'>)</span><span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> U, <span class='keyword'>auto</span> FromU, <span class='keyword'>auto</span> QS<span class='anglebracket'>></span>
|
||
<span class='keyword'>concept</span> <span class='texttt'><i >UnitCompatibleWith</i></span><a class='index' id='concept:UnitCompatibleWith'></a> <span class='operator'>=</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit______'><span class='texttt'>Unit</span></span></a><span class='anglebracket'><</span>U<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_______'><span class='texttt'>Unit</span></span></a><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>FromU<span class='parenthesis'>)</span><span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_______________________________________________________'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>QS<span class='parenthesis'>)</span><span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span>
|
||
<span class='parenthesis'>(</span><span class='operator'>!</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit__'><span class='texttt'>AssociatedUnit</span></span></a><span class='anglebracket'><</span>U<span class='anglebracket'>></span> <span class='operator'>|</span><span class='operator'>|</span> <a href='#concept:UnitOf' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:UnitOf___'><span class='texttt'>UnitOf</span></span></a><span class='anglebracket'><</span>U, QS<span class='anglebracket'>></span><span class='parenthesis'>)</span> <span class='operator'>&</span><span class='operator'>&</span> <a class='index' id='conceptref:UnitConvertibleTo'></a><span class='texttt'><i >UnitConvertibleTo</i></span><span class='anglebracket'><</span>FromU, U<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></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> <span class='texttt'><i >OffsetUnit</i></span><a class='index' id='concept:OffsetUnit'></a> <span class='operator'>=</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit________'><span class='texttt'>Unit</span></span></a><span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <span class='keyword'>requires</span> <span class='curlybracket'>{</span> T<span class='operator'>::</span><span class='texttt'><i >point-origin</i></span>; <span class='curlybracket'>}</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> From, <span class='keyword'>typename</span> To<span class='anglebracket'>></span>
|
||
<span class='keyword'>concept</span> <span class='texttt'><i >PotentiallyConvertibleTo</i></span><a class='index' id='concept:PotentiallyConvertibleTo'></a> <span class='operator'>=</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_________'><span class='texttt'>Unit</span></span></a><span class='anglebracket'><</span>From<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit__________'><span class='texttt'>Unit</span></span></a><span class='anglebracket'><</span>To<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span>
|
||
<span class='parenthesis'>(</span><span class='parenthesis'>(</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit___'><span class='texttt'>AssociatedUnit</span></span></a><span class='anglebracket'><</span>From<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit____'><span class='texttt'>AssociatedUnit</span></span></a><span class='anglebracket'><</span>To<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span>
|
||
implicitly_convertible<span class='parenthesis'>(</span>get_quantity_spec<span class='parenthesis'>(</span>From<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>, get_quantity_spec<span class='parenthesis'>(</span>To<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span> <span class='operator'>|</span><span class='operator'>|</span>
|
||
<span class='parenthesis'>(</span><span class='operator'>!</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit_____'><span class='texttt'>AssociatedUnit</span></span></a><span class='anglebracket'><</span>From<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <span class='operator'>!</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit______'><span class='texttt'>AssociatedUnit</span></span></a><span class='anglebracket'><</span>To<span class='anglebracket'>></span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>;
|
||
</code></div></div></div><div id='qty.unit.types' class='section'><h4 ><a class='secnum' href='#qty.unit.types' style='min-width:95pt'>5.4.4.5</a> Types <a class='abbr_ref' href='qty.unit.types.html'>[qty.unit.types]</a></h4><div id='qty.canon.unit' class='section'><h4 ><a class='secnum' href='#qty.canon.unit' style='min-width:110pt'>5.4.4.5.1</a> Canonical <a class='abbr_ref' href='qty.canon.unit.html'>[qty.canon.unit]</a></h4><div class='texpara'><span id='lib:canonical-unit'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:canonical-unit'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude___________'><span class='tcode_in_codeblock'>UnitMagnitude</span></span></a> M, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit___________'><span class='tcode_in_codeblock'>Unit</span></span></a> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>struct</span> <i >canonical-unit</i> <span class='curlybracket'>{</span> <span class='comment'>// <i >exposition only</i></span>
|
||
M mag;
|
||
U reference_unit;
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></div><div class='para' id='qty.canon.unit-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.canon.unit-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2597'>#</a></div><div class='texpara'><div id='qty.canon.unit-1.sentence-1' class='sentence'><span class='texttt'><i >canonical-unit</i></span> represents a unit expressed in terms of base units (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-18">IEC 60050, 112-01-18</a>)<a class='hidden_link' href='#qty.canon.unit-1.sentence-1'>.</a></div> <div id='qty.canon.unit-note-1' class='note'><div class='texpara'>[<i>Note <a href='#qty.canon.unit-note-1'>1</a></i>: <div id='qty.canon.unit-1.sentence-2' class='sentence'>Other types representing units are equal only if they have the same type<a class='hidden_link' href='#qty.canon.unit-1.sentence-2'>.</a></div> <div id='qty.canon.unit-1.sentence-3' class='sentence'><span class='texttt'><i >canonical-unit</i></span> is used to implement binary relations other than equality<a class='hidden_link' href='#qty.canon.unit-1.sentence-3'>.</a></div> — <i>end note</i>]</div></div> <div id='qty.canon.unit-1.sentence-4' class='sentence'><span class='texttt'>reference_<span class='shy'></span>unit</span> is simplified (<a href='qty.sym.expr.algos.html' title='5.3.4.4 Algorithms'>[qty.<span class='shy'></span>sym.<span class='shy'></span>expr.<span class='shy'></span>algos]</a>)<a class='hidden_link' href='#qty.canon.unit-1.sentence-4'>.</a></div></div></div><div class='texpara'><div id='lib:get-canonical-unit,Unit'><div id='lib:Unit,get-canonical-unit'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:Unit,get-canonical-unit'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <span class='keyword'>auto</span> <span class='texttt'><i >get-canonical-unit</i></span><span class='parenthesis'>(</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit____________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> u<span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
</code></div></div></div></div><div class='para' id='qty.canon.unit-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.canon.unit-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2611'>#</a></div><div class='texpara'><div id='qty.canon.unit-2.sentence-1' class='sentence'><i >Returns</i>: The instantiation of <span class='texttt'><i >canonical-unit</i></span> for <span class='texttt'>u</span><a class='hidden_link' href='#qty.canon.unit-2.sentence-1'>.</a></div></div></div></div></div><div id='qty.scaled.unit' class='section'><h4 ><a class='secnum' href='#qty.scaled.unit' style='min-width:110pt'>5.4.4.5.2</a> Scaled <a class='abbr_ref' href='qty.scaled.unit.html'>[qty.scaled.unit]</a></h4><div class='texpara'><span id='lib:scaled_unit'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:scaled_unit'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude____________'><span class='tcode_in_codeblock'>UnitMagnitude</span></span></a> <span class='keyword'>auto</span> M, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_____________'><span class='tcode_in_codeblock'>Unit</span></span></a> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span>M <span class='operator'>!</span><span class='operator'>=</span> <i >unit-magnitude</i><span class='anglebracket'><</span><span class='anglebracket'>></span><span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>&</span><span class='operator'>&</span> M <span class='operator'>!</span><span class='operator'>=</span> mag<span class='anglebracket'><</span><span class='literal'>1</span><span class='anglebracket'>></span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>struct</span> scaled_unit <span class='keyword'>final</span> <span class='operator'>:</span> <i >unit-interface</i> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>using</span> <i >base-type</i> <span class='operator'>=</span> scaled_unit; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude_____________'><span class='tcode_in_codeblock'>UnitMagnitude</span></span></a> <span class='keyword'>auto</span> <i >mag</i> <span class='operator'>=</span> M; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> U <i >reference-unit</i><span class='curlybracket'>{</span><span class='curlybracket'>}</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >point-origin</i> <span class='operator'>=</span> U<span class='operator'>::</span>point_origin; <span class='comment'>// <i >exposition only</i>, present only</span>
|
||
<span class='comment'>// if the <span class='textsf'><i >qualified-id</i></span> <span class='tcode_in_codeblock'>U​::​point_<span class='shy'></span>origin</span> is valid and denotes an object</span>
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></div><div class='para' id='qty.scaled.unit-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.scaled.unit-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2635'>#</a></div><div class='texpara'><div id='qty.scaled.unit-1.sentence-1' class='sentence'><span class='texttt'>scaled_<span class='shy'></span>unit<span class='anglebracket'><</span>M, U<span class='anglebracket'>></span></span> is used by the library
|
||
to represent the unit <span class='math'><span class='texttt'>M</span> ×<span class='texttt'>U</span></span><a class='hidden_link' href='#qty.scaled.unit-1.sentence-1'>.</a></div></div></div></div><div id='qty.named.unit' class='section'><h4 ><a class='secnum' href='#qty.named.unit' style='min-width:110pt'>5.4.4.5.3</a> Named <a class='abbr_ref' href='qty.named.unit.html'>[qty.named.unit]</a></h4><div class='texpara'><span id='lib:named_unit'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:named_unit'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span>symbol_text Symbol, <a class='index' id='conceptref:QuantityKindSpec____________'></a><i >QuantityKindSpec</i> <span class='keyword'>auto</span> QS<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span><span class='operator'>!</span>Symbol<span class='operator'>.</span>empty<span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span> <span class='operator'>&</span><span class='operator'>&</span> <a class='index' id='conceptref:BaseDimension__'></a><i >BaseDimension</i><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span><span class='keyword'>auto</span><span class='parenthesis'>(</span>QS<span class='operator'>.</span>dimension<span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='anglebracket'>></span>
|
||
<span class='keyword'>struct</span> named_unit<span class='anglebracket'><</span>Symbol, QS<span class='anglebracket'>></span> <span class='operator'>:</span> <i >unit-interface</i> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>using</span> <i >base-type</i> <span class='operator'>=</span> named_unit; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >symbol</i> <span class='operator'>=</span> Symbol; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >quantity-spec</i> <span class='operator'>=</span> QS; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span>symbol_text Symbol, <a class='index' id='conceptref:QuantityKindSpec_____________'></a><i >QuantityKindSpec</i> <span class='keyword'>auto</span> QS, <a href='qty.pt.orig.concepts.html#concept:PointOrigin' title='5.7.2.2 Concepts [qty.pt.orig.concepts]'><span id='conceptref:PointOrigin'><span class='tcode_in_codeblock'>PointOrigin</span></span></a> <span class='keyword'>auto</span> PO<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span><span class='operator'>!</span>Symbol<span class='operator'>.</span>empty<span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span> <span class='operator'>&</span><span class='operator'>&</span> <a class='index' id='conceptref:BaseDimension___'></a><i >BaseDimension</i><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span><span class='keyword'>auto</span><span class='parenthesis'>(</span>QS<span class='operator'>.</span>dimension<span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='anglebracket'>></span>
|
||
<span class='keyword'>struct</span> named_unit<span class='anglebracket'><</span>Symbol, QS, PO<span class='anglebracket'>></span> <span class='operator'>:</span> <i >unit-interface</i> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>using</span> <i >base-type</i> <span class='operator'>=</span> named_unit; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >symbol</i> <span class='operator'>=</span> Symbol; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >quantity-spec</i> <span class='operator'>=</span> QS; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >point-origin</i> <span class='operator'>=</span> PO; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span>symbol_text Symbol<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span><span class='operator'>!</span>Symbol<span class='operator'>.</span>empty<span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>struct</span> named_unit<span class='anglebracket'><</span>Symbol<span class='anglebracket'>></span> <span class='operator'>:</span> <i >unit-interface</i> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>using</span> <i >base-type</i> <span class='operator'>=</span> named_unit; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >symbol</i> <span class='operator'>=</span> Symbol; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span>symbol_text Symbol, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit______________'><span class='tcode_in_codeblock'>Unit</span></span></a> <span class='keyword'>auto</span> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span><span class='operator'>!</span>Symbol<span class='operator'>.</span>empty<span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>struct</span> named_unit<span class='anglebracket'><</span>Symbol, U<span class='anglebracket'>></span> <span class='operator'>:</span> <span class='keyword'>decltype</span><span class='parenthesis'>(</span>U<span class='parenthesis'>)</span><span class='operator'>::</span><i >base-type</i> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>using</span> <i >base-type</i> <span class='operator'>=</span> named_unit; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >symbol</i> <span class='operator'>=</span> Symbol; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span>symbol_text Symbol, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_______________'><span class='tcode_in_codeblock'>Unit</span></span></a> <span class='keyword'>auto</span> U, <a href='qty.pt.orig.concepts.html#concept:PointOrigin' title='5.7.2.2 Concepts [qty.pt.orig.concepts]'><span id='conceptref:PointOrigin_'><span class='tcode_in_codeblock'>PointOrigin</span></span></a> <span class='keyword'>auto</span> PO<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span><span class='operator'>!</span>Symbol<span class='operator'>.</span>empty<span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>struct</span> named_unit<span class='anglebracket'><</span>Symbol, U, PO<span class='anglebracket'>></span> <span class='operator'>:</span> <span class='keyword'>decltype</span><span class='parenthesis'>(</span>U<span class='parenthesis'>)</span><span class='operator'>::</span><i >base-type</i> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>using</span> <i >base-type</i> <span class='operator'>=</span> named_unit; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >symbol</i> <span class='operator'>=</span> Symbol; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >point-origin</i> <span class='operator'>=</span> PO; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span>symbol_text Symbol, <a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit_______'><span class='tcode_in_codeblock'>AssociatedUnit</span></span></a> <span class='keyword'>auto</span> U, <a class='index' id='conceptref:QuantityKindSpec______________'></a><i >QuantityKindSpec</i> <span class='keyword'>auto</span> QS<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span><span class='operator'>!</span>Symbol<span class='operator'>.</span>empty<span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span> <span class='operator'>&</span><span class='operator'>&</span> <span class='parenthesis'>(</span>QS<span class='operator'>.</span>dimension <span class='operator'>=</span><span class='operator'>=</span> <i >get-associated-quantity</i><span class='parenthesis'>(</span>U<span class='parenthesis'>)</span><span class='operator'>.</span>dimension<span class='parenthesis'>)</span>
|
||
<span class='keyword'>struct</span> named_unit<span class='anglebracket'><</span>Symbol, U, QS<span class='anglebracket'>></span> <span class='operator'>:</span> <span class='keyword'>decltype</span><span class='parenthesis'>(</span>U<span class='parenthesis'>)</span><span class='operator'>::</span><i >base-type</i> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>using</span> <i >base-type</i> <span class='operator'>=</span> named_unit; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >symbol</i> <span class='operator'>=</span> Symbol; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >quantity-spec</i> <span class='operator'>=</span> QS; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span>symbol_text Symbol, <a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit________'><span class='tcode_in_codeblock'>AssociatedUnit</span></span></a> <span class='keyword'>auto</span> U, <a class='index' id='conceptref:QuantityKindSpec_______________'></a><i >QuantityKindSpec</i> <span class='keyword'>auto</span> QS,
|
||
<a href='qty.pt.orig.concepts.html#concept:PointOrigin' title='5.7.2.2 Concepts [qty.pt.orig.concepts]'><span id='conceptref:PointOrigin__'><span class='tcode_in_codeblock'>PointOrigin</span></span></a> <span class='keyword'>auto</span> PO<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span><span class='operator'>!</span>Symbol<span class='operator'>.</span>empty<span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span> <span class='operator'>&</span><span class='operator'>&</span> <span class='parenthesis'>(</span>QS<span class='operator'>.</span>dimension <span class='operator'>=</span><span class='operator'>=</span> <i >get-associated-quantity</i><span class='parenthesis'>(</span>U<span class='parenthesis'>)</span><span class='operator'>.</span>dimension<span class='parenthesis'>)</span>
|
||
<span class='keyword'>struct</span> named_unit<span class='anglebracket'><</span>Symbol, U, QS, PO<span class='anglebracket'>></span> <span class='operator'>:</span> <span class='keyword'>decltype</span><span class='parenthesis'>(</span>U<span class='parenthesis'>)</span><span class='operator'>::</span><i >base-type</i> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>using</span> <i >base-type</i> <span class='operator'>=</span> named_unit; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >symbol</i> <span class='operator'>=</span> Symbol; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >quantity-spec</i> <span class='operator'>=</span> QS; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >point-origin</i> <span class='operator'>=</span> PO; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></div><div class='para' id='qty.named.unit-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.named.unit-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2705'>#</a></div><div class='texpara'><div id='qty.named.unit-1.sentence-1' class='sentence'>A <a class='hidden_link' href='#def:unit,named' title='5.4.4.5.3 Named [qty.named.unit]'><span id='def:unit,named'><i >named unit</i></span></a> is a type that models <a href='#concept:PrefixableUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:PrefixableUnit'><span class='texttt'>PrefixableUnit</span></span></a><a class='hidden_link' href='#qty.named.unit-1.sentence-1'>.</a></div> <div id='qty.named.unit-1.sentence-2' class='sentence'>A specialization of <span class='texttt'>named_<span class='shy'></span>unit</span> is used as a base type when defining a named unit<a class='hidden_link' href='#qty.named.unit-1.sentence-2'>.</a></div></div></div><div class='para' id='qty.named.unit-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.named.unit-2'>2</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2709'>#</a></div><div class='texpara'><div id='qty.named.unit-2.sentence-1' class='sentence'>In the following descriptions, let <span class='texttt'>U</span> be a named unit defined with an alluded signature<a class='hidden_link' href='#qty.named.unit-2.sentence-1'>.</a></div> <div id='qty.named.unit-2.sentence-2' class='sentence'>The identifier of <span class='texttt'>U</span> represents
|
||
its unit name (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-15">IEC 60050, 112-01-15</a>)
|
||
or special unit name (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-16">IEC 60050, 112-01-16</a>)<a class='hidden_link' href='#qty.named.unit-2.sentence-2'>.</a></div> <div id='qty.named.unit-2.sentence-3' class='sentence'><span class='texttt'>Symbol</span> is its unit symbol (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-17">IEC 60050, 112-01-17</a>)<a class='hidden_link' href='#qty.named.unit-2.sentence-3'>.</a></div></div></div><div class='para' id='qty.named.unit-3'><div class='marginalizedparent'><a class='marginalized' href='#qty.named.unit-3'>3</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2716'>#</a></div><div class='texpara'><div id='qty.named.unit-3.sentence-1' class='sentence'>The possible arguments to <span class='texttt'>named_<span class='shy'></span>unit</span> are
|
||
<ul class='itemize'><li id='qty.named.unit-3.1'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#qty.named.unit-3.1'>(3.1)</a></div><span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">(</span></span><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.519em;">the unit symbol</span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><span class="mjx-mtext MJXc-space1"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.519em;">a kind of base quantity</span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><span class="mjx-msubsup MJXc-space1"><span class="mjx-base"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.519em;">a point origin</span></span></span><span class="mjx-sub" style="font-size: 70.7%; vertical-align: -0.377em; padding-right: 0.071em;"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mstyle" style="font-size: 113.1%; color: black;"><span class="mjx-mrow" style="font-size: 88.4%;"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.225em; padding-bottom: 0.298em;">o</span></span></span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.225em; padding-bottom: 0.446em;">p</span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.372em; padding-bottom: 0.298em;">t</span></span></span></span></span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">)</span></span></span></span></span>,</li><li id='qty.named.unit-3.2'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#qty.named.unit-3.2'>(3.2)</a></div><span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">(</span></span><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.519em;">the unit symbol</span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">)</span></span></span></span></span>,</li><li id='qty.named.unit-3.3'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#qty.named.unit-3.3'>(3.3)</a></div><span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">(</span></span><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.519em;">the unit symbol</span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><span class="mjx-mtext MJXc-space1"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.519em;">a unit expression</span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><span class="mjx-msubsup MJXc-space1"><span class="mjx-base"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.519em;">a point origin</span></span></span><span class="mjx-sub" style="font-size: 70.7%; vertical-align: -0.377em; padding-right: 0.071em;"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mstyle" style="font-size: 113.1%; color: black;"><span class="mjx-mrow" style="font-size: 88.4%;"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.225em; padding-bottom: 0.298em;">o</span></span></span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.225em; padding-bottom: 0.446em;">p</span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.372em; padding-bottom: 0.298em;">t</span></span></span></span></span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">)</span></span></span></span></span>, and</li><li id='qty.named.unit-3.4'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#qty.named.unit-3.4'>(3.4)</a></div><span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">(</span></span><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.519em;">the unit symbol</span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><span class="mjx-mtext MJXc-space1"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.519em;">a unit expression</span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><span class="mjx-mtext MJXc-space1"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.519em;">a kind of quantity</span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><span class="mjx-msubsup MJXc-space1"><span class="mjx-base"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.519em;">a point origin</span></span></span><span class="mjx-sub" style="font-size: 70.7%; vertical-align: -0.377em; padding-right: 0.071em;"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mstyle" style="font-size: 113.1%; color: black;"><span class="mjx-mrow" style="font-size: 88.4%;"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.225em; padding-bottom: 0.298em;">o</span></span></span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.225em; padding-bottom: 0.446em;">p</span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-main-I" style="padding-top: 0.372em; padding-bottom: 0.298em;">t</span></span></span></span></span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">)</span></span></span></span></span><a class='hidden_link' href='#qty.named.unit-3.sentence-1'>.</a></li></ul></div></div></div><div class='para' id='qty.named.unit-4'><div class='marginalizedparent'><a class='marginalized' href='#qty.named.unit-4'>4</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2729'>#</a></div><div class='texpara'><div id='qty.named.unit-4.sentence-1' class='sentence'>The first signature defines the unit of a base quantity
|
||
without a unit prefix (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-26">IEC 60050, 112-01-26</a>)<a class='hidden_link' href='#qty.named.unit-4.sentence-1'>.</a></div> <div id='qty.named.unit-4.sentence-2' class='sentence'>The second signature defines a unit
|
||
that can be reused by several base quantities<a class='hidden_link' href='#qty.named.unit-4.sentence-2'>.</a></div> <div id='qty.named.unit-4.sentence-3' class='sentence'>The third and fourth signatures with a unit expression argument <i >E</i>
|
||
define <span class='texttt'>U</span> as implicitly convertible from <i >E</i><a class='hidden_link' href='#qty.named.unit-4.sentence-3'>.</a></div> <div id='qty.named.unit-4.sentence-4' class='sentence'>The first and fourth signatures with a kind of quantity (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-04">IEC 60050, 112-01-04</a>) <i >Q</i>
|
||
also restrict <span class='texttt'>U</span> to <i >Q</i><a class='hidden_link' href='#qty.named.unit-4.sentence-4'>.</a></div></div></div><div class='para' id='qty.named.unit-5'><div class='marginalizedparent'><a class='marginalized' href='#qty.named.unit-5'>5</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2739'>#</a></div><div class='texpara'><div id='qty.named.unit-5.sentence-1' class='sentence'>A point origin argument specifies the default point origin of <span class='texttt'>U</span> (<a href='qty.pt.syn.html' title='5.7.4 Class template quantity_­point'>[qty.<span class='shy'></span>pt.<span class='shy'></span>syn]</a>)<a class='hidden_link' href='#qty.named.unit-5.sentence-1'>.</a></div></div></div><div class='para nonNormativeOnly' id='qty.named.unit-6'><div class='marginalizedparent'><a class='marginalized' href='#qty.named.unit-6'>6</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2742'>#</a></div><div class='texpara'><div id='qty.named.unit-example-1' class='example'><div class='texpara'>[<i>Example <a href='#qty.named.unit-example-1'>1</a></i>: <span class='codeblock'><span class='comment'>// The first signature defines a base unit restricted to a kind of base quantity.</span>
|
||
<span class='keyword'>inline</span> <span class='keyword'>constexpr</span> <span class='keyword'>struct</span> second <span class='keyword'>final</span> <span class='operator'>:</span> named_unit<span class='anglebracket'><</span><span class='literal'>"s"</span>, kind_of<span class='anglebracket'><</span>time<span class='anglebracket'>></span><span class='anglebracket'>></span> <span class='curlybracket'>{</span>
|
||
<span class='curlybracket'>}</span> second;
|
||
|
||
<span class='comment'>// The third and fourth signatures give a name to the unit argument.</span>
|
||
<span class='keyword'>inline</span> <span class='keyword'>constexpr</span> <span class='keyword'>struct</span> minute <span class='keyword'>final</span> <span class='operator'>:</span> named_unit<span class='anglebracket'><</span><span class='literal'>"min"</span>, mag<span class='anglebracket'><</span><span class='literal'>60</span><span class='anglebracket'>></span> <span class='operator'>*</span> second<span class='anglebracket'>></span> <span class='curlybracket'>{</span>
|
||
<span class='curlybracket'>}</span> minute; <span class='comment'>// <span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">min</span></span></span></span><span class="mjx-mo MJXc-space3"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.077em; padding-bottom: 0.298em;">=</span></span><span class="mjx-mn MJXc-space3"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">60</span></span><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.151em; padding-bottom: 0.372em;"> s</span></span></span></span></span></span></span>.</span>
|
||
|
||
<span class='comment'>// The fourth signature also further restricts the kind of quantity.</span>
|
||
<span class='keyword'>inline</span> <span class='keyword'>constexpr</span> <span class='keyword'>struct</span> hertz <span class='keyword'>final</span> <span class='operator'>:</span> named_unit<span class='anglebracket'><</span><span class='literal'>"Hz"</span>, inverse<span class='parenthesis'>(</span>second<span class='parenthesis'>)</span>, kind_of<span class='anglebracket'><</span>frequency<span class='anglebracket'>></span><span class='anglebracket'>></span> <span class='curlybracket'>{</span>
|
||
<span class='curlybracket'>}</span> hertz; <span class='comment'>// <span class='math'><span class='textrm'>Hz</span></span> can't measure becquerel, activity,</span>
|
||
<span class='comment'>// or any other quantity with dimension <span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-msubsup"><span class="mjx-base"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">T</span></span></span></span></span><span class="mjx-sup" style="font-size: 70.7%; vertical-align: 0.607em; padding-left: 0px; padding-right: 0.071em;"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.298em; padding-bottom: 0.446em;">−</span></span><span class="mjx-mn"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">1</span></span></span></span></span></span></span></span></span></span>
|
||
<span class='comment'>// that isn't a kind of frequency.</span>
|
||
</span> — <i>end example</i>]</div></div></div></div></div><div id='qty.prefixed.unit' class='section'><h4 ><a class='secnum' href='#qty.prefixed.unit' style='min-width:110pt'>5.4.4.5.4</a> Prefixed <a class='abbr_ref' href='qty.prefixed.unit.html'>[qty.prefixed.unit]</a></h4><div class='texpara'><span id='lib:prefixed_unit'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:prefixed_unit'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span>symbol_text Symbol, <a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude______________'><span class='tcode_in_codeblock'>UnitMagnitude</span></span></a> <span class='keyword'>auto</span> M, <a href='#concept:PrefixableUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:PrefixableUnit_'><span class='tcode_in_codeblock'>PrefixableUnit</span></span></a> <span class='keyword'>auto</span> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span><span class='operator'>!</span>Symbol<span class='operator'>.</span>empty<span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>struct</span> prefixed_unit <span class='operator'>:</span> <span class='keyword'>decltype</span><span class='parenthesis'>(</span>M <span class='operator'>*</span> U<span class='parenthesis'>)</span><span class='operator'>::</span><i >base-type</i> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>using</span> <i >base-type</i> <span class='operator'>=</span> prefixed_unit; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >symbol</i> <span class='operator'>=</span> Symbol <span class='operator'>+</span> U<span class='operator'>.</span><i >symbol</i>; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></div><div class='para' id='qty.prefixed.unit-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.prefixed.unit-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2777'>#</a></div><div class='texpara'><div id='qty.prefixed.unit-1.sentence-1' class='sentence'><span class='texttt'>prefixed_<span class='shy'></span>unit<span class='anglebracket'><</span>Symbol, M, U<span class='anglebracket'>></span></span> represents the unit <span class='texttt'>U</span> with a unit prefix (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-26">IEC 60050, 112-01-26</a>)<a class='hidden_link' href='#qty.prefixed.unit-1.sentence-1'>.</a></div> <div id='qty.prefixed.unit-1.sentence-2' class='sentence'><span class='texttt'>Symbol</span> is the symbol of the unit prefix<a class='hidden_link' href='#qty.prefixed.unit-1.sentence-2'>.</a></div> <div id='qty.prefixed.unit-1.sentence-3' class='sentence'><span class='texttt'>M</span> is the factor of the unit prefix<a class='hidden_link' href='#qty.prefixed.unit-1.sentence-3'>.</a></div> <div id='qty.prefixed.unit-1.sentence-4' class='sentence'>A specialization of <span class='texttt'>prefixed_<span class='shy'></span>unit</span> is used as a base type when defining a unit prefix<a class='hidden_link' href='#qty.prefixed.unit-1.sentence-4'>.</a></div> <div id='qty.prefixed.unit-example-1' class='example'><div class='texpara'>[<i>Example <a href='#qty.prefixed.unit-example-1'>1</a></i>: <span class='codeblock'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:PrefixableUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:PrefixableUnit__'><span class='tcode_in_codeblock'>PrefixableUnit</span></span></a> <span class='keyword'>auto</span> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>struct</span> kilo_ <span class='operator'>:</span> prefixed_unit<span class='anglebracket'><</span><span class='literal'>"k"</span>, mag_power<span class='anglebracket'><</span><span class='literal'>10</span>, <span class='literal'>3</span><span class='anglebracket'>></span>, U<span class='anglebracket'>></span> <span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:PrefixableUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:PrefixableUnit___'><span class='tcode_in_codeblock'>PrefixableUnit</span></span></a> <span class='keyword'>auto</span> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>constexpr</span> kilo_<span class='anglebracket'><</span>U<span class='anglebracket'>></span> kilo;
|
||
|
||
<span class='keyword'>inline</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> kilogram <span class='operator'>=</span> kilo<span class='anglebracket'><</span>si<span class='operator'>::</span>gram<span class='anglebracket'>></span>;
|
||
</span> — <i>end example</i>]</div></div></div></div></div><div id='qty.common.unit' class='section'><h4 ><a class='secnum' href='#qty.common.unit' style='min-width:110pt'>5.4.4.5.5</a> Common <a class='abbr_ref' href='qty.common.unit.html'>[qty.common.unit]</a></h4><div class='texpara'><span id='lib:common_unit'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:common_unit'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit________________'><span class='tcode_in_codeblock'>Unit</span></span></a> U1, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_________________'><span class='tcode_in_codeblock'>Unit</span></span></a> U2, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit__________________'><span class='tcode_in_codeblock'>Unit</span></span></a><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> Rest<span class='anglebracket'>></span>
|
||
<span class='keyword'>struct</span> common_unit <span class='keyword'>final</span> <span class='operator'>:</span> <span class='keyword'>decltype</span><span class='parenthesis'>(</span><i >get-common-scaled-unit</i><span class='parenthesis'>(</span>U1<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, U2<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Rest<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='operator'>::</span><i >base-type</i>
|
||
<span class='curlybracket'>{</span>
|
||
<span class='keyword'>using</span> <i >base-type</i> <span class='operator'>=</span> common_unit; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >common-unit</i> <span class='operator'>=</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<i >get-common-scaled-unit</i><span class='parenthesis'>(</span>U1<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, U2<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Rest<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>)</span>;
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></div><div class='para' id='qty.common.unit-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.common.unit-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2811'>#</a></div><div class='texpara'><div id='qty.common.unit-1.sentence-1' class='sentence'><span class='texttt'>common_<span class='shy'></span>unit</span> is used by the library
|
||
to encapsulate a conversion factor between units (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-33">IEC 60050, 112-01-33</a>)
|
||
common to the operands of quantity addition<a class='hidden_link' href='#qty.common.unit-1.sentence-1'>.</a></div> <div id='qty.common.unit-example-1' class='example'><div class='texpara'>[<i>Example <a href='#qty.common.unit-example-1'>1</a></i>: <div id='qty.common.unit-1.sentence-2' class='sentence'>The result of <span class='texttt'><span class='literal'>1</span> <span class='operator'>*</span> km <span class='operator'>+</span> <span class='literal'>1</span> <span class='operator'>*</span> mi</span>
|
||
has a common unit <span class="mjx-chtml"><span class="mjx-math"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">[</span></span><span class="mjx-mn"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">8</span></span><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">/</span></span></span></span><span class="mjx-mn"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">125</span></span><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.593em;">]</span></span><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mtext"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.151em; padding-bottom: 0.372em;"> m</span></span></span></span></span></span></span>
|
||
encapsulated by <span class='texttt'>common_<span class='shy'></span>unit<span class='anglebracket'><</span>mi, km<span class='anglebracket'>></span></span><a class='hidden_link' href='#qty.common.unit-1.sentence-2'>.</a></div> — <i>end example</i>]</div></div> <div id='qty.common.unit-1.sentence-3' class='sentence'>
|
||
A program that instantiates a specialization of <span class='texttt'>common_<span class='shy'></span>unit</span>
|
||
that is not a possible result of the library specifications
|
||
is ill-formed, no diagnostic required<a class='hidden_link' href='#qty.common.unit-1.sentence-3'>.</a></div></div></div><div class='texpara'><div class='itemdecl' id='qty.common.unit-itemdecl:1'><div class='marginalizedparent'><a class='itemDeclLink' href='#qty.common.unit-itemdecl:1'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit___________________'><span class='texttt'>Unit</span></span></a> U1, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit____________________'><span class='texttt'>Unit</span></span></a> U2, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_____________________'><span class='texttt'>Unit</span></span></a><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> Rest<span class='anglebracket'>></span>
|
||
<span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit______________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> <span class='texttt'><i >get-common-scaled-unit</i></span><span class='parenthesis'>(</span>U1, U2, Rest<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> rest<span class='parenthesis'>)</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>requires</span> <i ><span class='texttt'>see below</span></i>;
|
||
</code></div></div><div class='para' id='qty.common.unit-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.common.unit-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2831'>#</a></div><div class='texpara'><div id='qty.common.unit-2.sentence-1' class='sentence'><i >Effects</i>: Equivalent to:
|
||
<span class='codeblock'><span class='keyword'>constexpr</span> <span class='keyword'>auto</span> res <span class='operator'>=</span> <span class='squarebracket'>[</span><span class='squarebracket'>]</span> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>constexpr</span> <span class='keyword'>auto</span> canonical_lhs <span class='operator'>=</span> <i >get-canonical-unit</i><span class='parenthesis'>(</span>U1<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>;
|
||
<span class='keyword'>constexpr</span> <span class='keyword'>auto</span> canonical_rhs <span class='operator'>=</span> <i >get-canonical-unit</i><span class='parenthesis'>(</span>U2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>;
|
||
<span class='keyword'>constexpr</span> <span class='keyword'>auto</span> common_mag <span class='operator'>=</span> <i >common-magnitude</i><span class='parenthesis'>(</span>canonical_lhs<span class='operator'>.</span>mag, canonical_rhs<span class='operator'>.</span>mag<span class='parenthesis'>)</span>;
|
||
<span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span>common_mag <span class='operator'>=</span><span class='operator'>=</span> mag<span class='anglebracket'><</span><span class='literal'>1</span><span class='anglebracket'>></span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> canonical_lhs<span class='operator'>.</span>reference_unit;
|
||
<span class='keyword'>else</span>
|
||
<span class='keyword'>return</span> scaled_unit<span class='anglebracket'><</span>common_mag, <span class='keyword'>decltype</span><span class='parenthesis'>(</span><span class='keyword'>auto</span><span class='parenthesis'>(</span>canonical_lhs<span class='operator'>.</span>reference_unit<span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='anglebracket'>></span><span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
<span class='curlybracket'>}</span><span class='parenthesis'>(</span><span class='parenthesis'>)</span>;
|
||
<span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><span class='keyword'>sizeof</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>(</span>rest<span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> <span class='literal'>0</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> res;
|
||
<span class='keyword'>else</span>
|
||
<span class='keyword'>return</span> <i >get-common-scaled-unit</i><span class='parenthesis'>(</span>res, rest<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>)</span>;
|
||
</span></div></div></div></div><div class='para' id='qty.common.unit-3'><div class='marginalizedparent'><a class='marginalized' href='#qty.common.unit-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2850'>#</a></div><div class='texpara'><div id='qty.common.unit-3.sentence-1' class='sentence'><i >Remarks</i>: The expression in the <span class='textsf'><i >requires-clause</i></span> is equivalent to:
|
||
<span class='codeblock'><span class='parenthesis'>(</span>convertible<span class='parenthesis'>(</span>U1<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, U2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span> <span class='operator'>&</span><span class='operator'>&</span> <span class='parenthesis'>(</span><span class='keyword'>sizeof</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>(</span>Rest<span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> <span class='literal'>0</span> <span class='operator'>|</span><span class='operator'>|</span> <span class='keyword'>requires</span> <span class='curlybracket'>{</span>
|
||
<i >get-common-scaled-unit</i><span class='parenthesis'>(</span><i >get-common-scaled-unit</i><span class='parenthesis'>(</span>u1, u2<span class='parenthesis'>)</span>, rest<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>)</span>;
|
||
<span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
</span></div></div></div></div></div><div id='qty.derived.unit' class='section'><h4 ><a class='secnum' href='#qty.derived.unit' style='min-width:110pt'>5.4.4.5.6</a> Derived <a class='abbr_ref' href='qty.derived.unit.html'>[qty.derived.unit]</a></h4><div class='texpara'><span id='lib:derived_unit'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:derived_unit'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> Expr<span class='anglebracket'>></span>
|
||
<span class='keyword'>struct</span> <i >derived-unit-impl</i> <span class='operator'>:</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<i >unit-interface</i>,
|
||
<i >expr-fractions</i><span class='anglebracket'><</span><span class='keyword'>struct</span> one, Expr<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>></span> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>using</span> <i >base-type</i> <span class='operator'>=</span> <i >derived-unit-impl</i>; <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a class='index' id='conceptref:SymbolicConstant______'></a><i >SymbolicConstant</i><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> Expr<span class='anglebracket'>></span>
|
||
<span class='keyword'>struct</span> derived_unit <span class='keyword'>final</span> <span class='operator'>:</span> <i >derived-unit-impl</i><span class='anglebracket'><</span>Expr<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>></span> <span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></div><div class='para' id='qty.derived.unit-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.derived.unit-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2879'>#</a></div><div class='texpara'><div id='qty.derived.unit-1.sentence-1' class='sentence'><span class='texttt'>derived_<span class='shy'></span>unit</span> is used by the library
|
||
to represent a derived unit (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-19">IEC 60050, 112-01-19</a>)<a class='hidden_link' href='#qty.derived.unit-1.sentence-1'>.</a></div> <div id='qty.derived.unit-example-1' class='example'><div class='texpara'>[<i>Example <a href='#qty.derived.unit-example-1'>1</a></i>: <span class='codeblock'><span class='keyword'>using</span> <span class='keyword'>namespace</span> si<span class='operator'>::</span>unit_symbols;
|
||
<span class='keyword'>int</span> x <span class='operator'>=</span> m <span class='operator'>*</span> m; <span class='comment'>// error: cannot construct from <span class='tcode_in_codeblock'>derived_<span class='shy'></span>unit<power<si​::​metre, 2>></span></span>
|
||
<span class='keyword'>int</span> y <span class='operator'>=</span> m <span class='operator'>*</span> s; <span class='comment'>// error: cannot construct from <span class='tcode_in_codeblock'>derived_<span class='shy'></span>unit<si​::​metre, si​::​second></span></span>
|
||
<span class='keyword'>int</span> z <span class='operator'>=</span> m <span class='operator'>/</span> s; <span class='comment'>// error: cannot construct from <span class='tcode_in_codeblock'>derived_<span class='shy'></span>unit<si​::​metre, per<si​::​second>></span></span>
|
||
</span> — <i>end example</i>]</div></div> <div id='qty.derived.unit-1.sentence-2' class='sentence'>
|
||
A program that instantiates a specialization of <span class='texttt'>derived_<span class='shy'></span>unit</span>
|
||
that is not a possible result of the library specifications
|
||
is ill-formed, no diagnostic required<a class='hidden_link' href='#qty.derived.unit-1.sentence-2'>.</a></div></div></div></div><div id='qty.unit.one' class='section'><h4 ><a class='secnum' href='#qty.unit.one' style='min-width:110pt'>5.4.4.5.7</a> One <a class='abbr_ref' href='qty.unit.one.html'>[qty.unit.one]</a></h4><div class='texpara'><span id='lib:one'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:one'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>struct</span> one <span class='keyword'>final</span> <span class='operator'>:</span> <i >derived-unit-impl</i><span class='anglebracket'><</span><span class='anglebracket'>></span> <span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></div><div class='para' id='qty.unit.one-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.one-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2905'>#</a></div><div class='texpara'><div id='qty.unit.one-1.sentence-1' class='sentence'><span class='texttt'>one</span> represents the base unit (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-18">IEC 60050, 112-01-18</a>) of a quantity of dimension one (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-13">IEC 60050, 112-01-13</a>)<a class='hidden_link' href='#qty.unit.one-1.sentence-1'>.</a></div></div></div></div></div><div id='qty.unit.ops' class='section'><h4 ><a class='secnum' href='#qty.unit.ops' style='min-width:95pt'>5.4.4.6</a> Operations <a class='abbr_ref' href='qty.unit.ops.html'>[qty.unit.ops]</a></h4><div class='texpara'><span id='lib:unit-interface'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:unit-interface'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>struct</span> <i >unit-interface</i> <span class='curlybracket'>{</span> <span class='comment'>// <i >exposition only</i></span>
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude_______________'><span class='tcode_in_codeblock'>UnitMagnitude</span></span></a> M, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_______________________'><span class='tcode_in_codeblock'>Unit</span></span></a> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit________________________'><span class='tcode_in_codeblock'>Unit</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span>M, U u<span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_________________________'><span class='tcode_in_codeblock'>Unit</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit__________________________'><span class='tcode_in_codeblock'>Unit</span></span></a> <span class='keyword'>auto</span>, <a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude________________'><span class='tcode_in_codeblock'>UnitMagnitude</span></span></a> <span class='keyword'>auto</span><span class='parenthesis'>)</span> <span class='operator'>=</span> <span class='keyword'>delete</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude_________________'><span class='tcode_in_codeblock'>UnitMagnitude</span></span></a> M, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit___________________________'><span class='tcode_in_codeblock'>Unit</span></span></a> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit____________________________'><span class='tcode_in_codeblock'>Unit</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>/</span><span class='parenthesis'>(</span>M mag, U u<span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_____________________________'><span class='tcode_in_codeblock'>Unit</span></span></a> Lhs, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit______________________________'><span class='tcode_in_codeblock'>Unit</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_______________________________'><span class='tcode_in_codeblock'>Unit</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span>Lhs lhs, Rhs rhs<span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit________________________________'><span class='tcode_in_codeblock'>Unit</span></span></a> Lhs, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_________________________________'><span class='tcode_in_codeblock'>Unit</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit__________________________________'><span class='tcode_in_codeblock'>Unit</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>/</span><span class='parenthesis'>(</span>Lhs lhs, Rhs rhs<span class='parenthesis'>)</span>;
|
||
|
||
<span class='comment'>// <a href='#qty.unit.cmp' title='5.4.4.7 Comparison'>[qty.<span class='shy'></span>unit.<span class='shy'></span>cmp]</a>, comparison</span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit___________________________________'><span class='tcode_in_codeblock'>Unit</span></span></a> Lhs, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit____________________________________'><span class='tcode_in_codeblock'>Unit</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> <span class='keyword'>operator</span><span class='operator'>=</span><span class='operator'>=</span><span class='parenthesis'>(</span>Lhs, Rhs<span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_____________________________________'><span class='tcode_in_codeblock'>Unit</span></span></a> Lhs, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit______________________________________'><span class='tcode_in_codeblock'>Unit</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> equivalent<span class='parenthesis'>(</span>Lhs lhs, Rhs rhs<span class='parenthesis'>)</span>;
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></div><div class='texpara'><div id='lib:Unit,operator*'><div id='lib:operator*,Unit'><div id='lib:UnitMagnitude,operator*_'><div id='lib:operator*,UnitMagnitude_'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator*,UnitMagnitude_'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude__________________'><span class='texttt'>UnitMagnitude</span></span></a> M, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_______________________________________'><span class='texttt'>Unit</span></span></a> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span>M, U u<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div></div></div><div class='para' id='qty.unit.ops-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.ops-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2949'>#</a></div><div class='texpara'><div id='qty.unit.ops-1.sentence-1' class='sentence'><i >Effects</i>: Equivalent to:
|
||
<span class='codeblock'><span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span>std<span class='operator'>::</span>is_same_v<span class='anglebracket'><</span>M, <span class='keyword'>decltype</span><span class='parenthesis'>(</span><span class='keyword'>auto</span><span class='parenthesis'>(</span>mag<span class='anglebracket'><</span><span class='literal'>1</span><span class='anglebracket'>></span><span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='anglebracket'>></span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> u;
|
||
<span class='keyword'>else</span> <span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><i >is-specialization-of</i><span class='anglebracket'><</span>U, scaled_unit<span class='anglebracket'>></span><span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span>M<span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>*</span> U<span class='operator'>::</span><i >mag</i> <span class='operator'>=</span><span class='operator'>=</span> mag<span class='anglebracket'><</span><span class='literal'>1</span><span class='anglebracket'>></span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> U<span class='operator'>::</span><i >reference-unit</i>;
|
||
<span class='keyword'>else</span>
|
||
<span class='keyword'>return</span> scaled_unit<span class='anglebracket'><</span>M<span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>*</span> U<span class='operator'>::</span><i >mag</i>, <span class='keyword'>decltype</span><span class='parenthesis'>(</span><span class='keyword'>auto</span><span class='parenthesis'>(</span>U<span class='operator'>::</span><i >reference-unit</i><span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='anglebracket'>></span><span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
<span class='curlybracket'>}</span> <span class='keyword'>else</span>
|
||
<span class='keyword'>return</span> scaled_unit<span class='anglebracket'><</span>M<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, U<span class='anglebracket'>></span><span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
</span></div></div></div></div><div class='texpara'><div class='itemdecl' id='qty.unit.ops-itemdecl:2'><div class='marginalizedparent'><a class='itemDeclLink' href='#qty.unit.ops-itemdecl:2'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit__________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span>, <a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude___________________'><span class='texttt'>UnitMagnitude</span></span></a> <span class='keyword'>auto</span><span class='parenthesis'>)</span> <span class='operator'>=</span> <span class='keyword'>delete</span>;
|
||
</code></div></div><div class='para' id='qty.unit.ops-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.ops-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2970'>#</a></div><div class='texpara'><div id='qty.unit.ops-2.sentence-1' class='sentence'><i >Recommended practice</i>: Suggest swapping the operands<a class='hidden_link' href='#qty.unit.ops-2.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Unit,operator/'><div id='lib:operator/,Unit'><div id='lib:UnitMagnitude,operator/_'><div id='lib:operator/,UnitMagnitude_'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator/,UnitMagnitude_'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:UnitMagnitude' title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude____________________'><span class='texttt'>UnitMagnitude</span></span></a> M, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit___________________________________________'><span class='texttt'>Unit</span></span></a> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit____________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>/</span><span class='parenthesis'>(</span>M mag, U u<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div></div></div><div class='para' id='qty.unit.ops-3'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.ops-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2983'>#</a></div><div class='texpara'><div id='qty.unit.ops-3.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>mag <span class='operator'>*</span> inverse<span class='parenthesis'>(</span>u<span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.unit.ops-3.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Unit,operator*_'><div id='lib:operator*,Unit_'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator*,Unit_'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_____________________________________________'><span class='texttt'>Unit</span></span></a> Lhs, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit______________________________________________'><span class='texttt'>Unit</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_______________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span>Lhs lhs, Rhs rhs<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.ops-4'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.ops-4'>4</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L2995'>#</a></div><div class='texpara'><div id='qty.unit.ops-4.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'><span class='texttt'><i >expr-multiply</i></span><span class='anglebracket'><</span>derived_<span class='shy'></span>unit, <span class='keyword'>struct</span> one<span class='anglebracket'>></span><span class='parenthesis'>(</span>lhs, rhs<span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.unit.ops-4.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Unit,operator/_'><div id='lib:operator/,Unit_'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator/,Unit_'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit________________________________________________'><span class='texttt'>Unit</span></span></a> Lhs, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_________________________________________________'><span class='texttt'>Unit</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit__________________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>/</span><span class='parenthesis'>(</span>Lhs lhs, Rhs rhs<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.ops-5'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.ops-5'>5</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3007'>#</a></div><div class='texpara'><div id='qty.unit.ops-5.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'><span class='texttt'><i >expr-divide</i></span><span class='anglebracket'><</span>derived_<span class='shy'></span>unit, <span class='keyword'>struct</span> one<span class='anglebracket'>></span><span class='parenthesis'>(</span>lhs, rhs<span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.unit.ops-5.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Unit,inverse'><div id='lib:inverse,Unit'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:inverse,Unit'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit___________________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> inverse<span class='parenthesis'>(</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit____________________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> u<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.ops-6'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.ops-6'>6</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3018'>#</a></div><div class='texpara'><div id='qty.unit.ops-6.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>one <span class='operator'>/</span> u</span><a class='hidden_link' href='#qty.unit.ops-6.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Unit,pow'><div id='lib:pow,Unit'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:pow,Unit'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span>std<span class='operator'>::</span>intmax_t Num, std<span class='operator'>::</span>intmax_t Den <span class='operator'>=</span> <span class='literal'>1</span>, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_____________________________________________________'><span class='texttt'>Unit</span></span></a> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span>Den <span class='operator'>!</span><span class='operator'>=</span> <span class='literal'>0</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit______________________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> pow<span class='parenthesis'>(</span>U u<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.ops-7'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.ops-7'>7</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3031'>#</a></div><div class='texpara'><div id='qty.unit.ops-7.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'><span class='texttt'><i >expr-pow</i></span><span class='anglebracket'><</span>Num, Den, derived_<span class='shy'></span>unit, <span class='keyword'>struct</span> one<span class='anglebracket'>></span><span class='parenthesis'>(</span>u<span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.unit.ops-7.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Unit,sqrt'><div id='lib:sqrt,Unit'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:sqrt,Unit'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_______________________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> sqrt<span class='parenthesis'>(</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit________________________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> u<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.ops-8'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.ops-8'>8</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3042'>#</a></div><div class='texpara'><div id='qty.unit.ops-8.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>pow<span class='anglebracket'><</span><span class='literal'>1</span>, <span class='literal'>2</span><span class='anglebracket'>></span><span class='parenthesis'>(</span>u<span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.unit.ops-8.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Unit,cbrt'><div id='lib:cbrt,Unit'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:cbrt,Unit'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_________________________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> cbrt<span class='parenthesis'>(</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit__________________________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> u<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.ops-9'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.ops-9'>9</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3053'>#</a></div><div class='texpara'><div id='qty.unit.ops-9.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>pow<span class='anglebracket'><</span><span class='literal'>1</span>, <span class='literal'>3</span><span class='anglebracket'>></span><span class='parenthesis'>(</span>u<span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.unit.ops-9.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Unit,square'><div id='lib:square,Unit'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:square,Unit'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit___________________________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> square<span class='parenthesis'>(</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit____________________________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> u<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.ops-10'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.ops-10'>10</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3064'>#</a></div><div class='texpara'><div id='qty.unit.ops-10.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>pow<span class='anglebracket'><</span><span class='literal'>2</span><span class='anglebracket'>></span><span class='parenthesis'>(</span>u<span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.unit.ops-10.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Unit,cubic'><div id='lib:cubic,Unit'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:cubic,Unit'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_____________________________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> cubic<span class='parenthesis'>(</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit______________________________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> u<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.ops-11'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.ops-11'>11</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3075'>#</a></div><div class='texpara'><div id='qty.unit.ops-11.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>pow<span class='anglebracket'><</span><span class='literal'>3</span><span class='anglebracket'>></span><span class='parenthesis'>(</span>u<span class='parenthesis'>)</span></span><a class='hidden_link' href='#qty.unit.ops-11.sentence-1'>.</a></div></div></div></div></div><div id='qty.unit.cmp' class='section'><h4 ><a class='secnum' href='#qty.unit.cmp' style='min-width:95pt'>5.4.4.7</a> Comparison <a class='abbr_ref' href='qty.unit.cmp.html'>[qty.unit.cmp]</a></h4><div class='texpara'><div id='lib:Unit,operator=='><div id='lib:operator==,Unit'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator==,Unit'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_______________________________________________________________'><span class='texttt'>Unit</span></span></a> Lhs, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit________________________________________________________________'><span class='texttt'>Unit</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> <span class='keyword'>operator</span><span class='operator'>=</span><span class='operator'>=</span><span class='parenthesis'>(</span>Lhs, Rhs<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.cmp-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.cmp-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3089'>#</a></div><div class='texpara'><div id='qty.unit.cmp-1.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>std<span class='operator'>​::​</span>is_<span class='shy'></span>same_<span class='shy'></span>v<span class='anglebracket'><</span>Lhs, Rhs<span class='anglebracket'>></span></span><a class='hidden_link' href='#qty.unit.cmp-1.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Unit,equivalent'><div id='lib:equivalent,Unit'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:equivalent,Unit'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_________________________________________________________________'><span class='texttt'>Unit</span></span></a> Lhs, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit__________________________________________________________________'><span class='texttt'>Unit</span></span></a> Rhs<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> equivalent<span class='parenthesis'>(</span>Lhs lhs, Rhs rhs<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.cmp-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.cmp-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3101'>#</a></div><div class='texpara'><div id='qty.unit.cmp-2.sentence-1' class='sentence'><i >Effects</i>: Equivalent to:
|
||
<span class='codeblock'><span class='keyword'>const</span> <span class='keyword'>auto</span> lhs_canonical <span class='operator'>=</span> <i >get-canonical-unit</i><span class='parenthesis'>(</span>lhs<span class='parenthesis'>)</span>;
|
||
<span class='keyword'>const</span> <span class='keyword'>auto</span> rhs_canonical <span class='operator'>=</span> <i >get-canonical-unit</i><span class='parenthesis'>(</span>rhs<span class='parenthesis'>)</span>;
|
||
<span class='keyword'>return</span> lhs_canonical<span class='operator'>.</span>mag <span class='operator'>=</span><span class='operator'>=</span> rhs_canonical<span class='operator'>.</span>mag <span class='operator'>&</span><span class='operator'>&</span>
|
||
lhs_canonical<span class='operator'>.</span>reference_unit <span class='operator'>=</span><span class='operator'>=</span> rhs_canonical<span class='operator'>.</span>reference_unit;
|
||
</span></div></div></div></div><div class='texpara'><div id='lib:Unit,convertible'><div id='lib:convertible,Unit'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:convertible,Unit'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit___________________________________________________________________'><span class='texttt'>Unit</span></span></a> From, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit____________________________________________________________________'><span class='texttt'>Unit</span></span></a> To<span class='anglebracket'>></span>
|
||
<span class='keyword'>consteval</span> <span class='keyword'>bool</span> convertible<span class='parenthesis'>(</span>From from, To to<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.cmp-3'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.cmp-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3119'>#</a></div><div class='texpara'><div id='qty.unit.cmp-3.sentence-1' class='sentence'><i >Effects</i>: Equivalent to:
|
||
<span class='codeblock'><span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span>std<span class='operator'>::</span>is_same_v<span class='anglebracket'><</span>From, To<span class='anglebracket'>></span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> <span class='literal'>true</span>;
|
||
<span class='keyword'>else</span> <span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><a class='index' id='conceptref:PotentiallyConvertibleTo'></a><i >PotentiallyConvertibleTo</i><span class='anglebracket'><</span>From, To<span class='anglebracket'>></span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> std<span class='operator'>::</span>is_same_v<span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span><i >get-canonical-unit</i><span class='parenthesis'>(</span>from<span class='parenthesis'>)</span><span class='operator'>.</span>reference_unit<span class='parenthesis'>)</span>,
|
||
<span class='keyword'>decltype</span><span class='parenthesis'>(</span><i >get-canonical-unit</i><span class='parenthesis'>(</span>to<span class='parenthesis'>)</span><span class='operator'>.</span>reference_unit<span class='parenthesis'>)</span><span class='anglebracket'>></span>;
|
||
<span class='keyword'>else</span>
|
||
<span class='keyword'>return</span> <span class='literal'>false</span>;
|
||
</span></div></div></div></div></div><div id='qty.unit.obs' class='section'><h4 ><a class='secnum' href='#qty.unit.obs' style='min-width:95pt'>5.4.4.8</a> Observers <a class='abbr_ref' href='qty.unit.obs.html'>[qty.unit.obs]</a></h4><div class='texpara'><div id='lib:AssociatedUnit,get_quantity_spec'><div id='lib:get_quantity_spec,AssociatedUnit'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:get_quantity_spec,AssociatedUnit'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec________________________________________________________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> get_quantity_spec<span class='parenthesis'>(</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit_________'><span class='texttt'>AssociatedUnit</span></span></a> <span class='keyword'>auto</span> u<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.obs-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.obs-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3141'>#</a></div><div class='texpara'><div id='qty.unit.obs-1.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>kind_<span class='shy'></span>of<span class='anglebracket'><</span><span class='texttt'><i >get-associated-quantity</i></span><span class='parenthesis'>(</span>u<span class='parenthesis'>)</span><span class='anglebracket'>></span></span><a class='hidden_link' href='#qty.unit.obs-1.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:AssociatedUnit,get_unit'><div id='lib:get_unit,AssociatedUnit'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:get_unit,AssociatedUnit'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_____________________________________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> get_unit<span class='parenthesis'>(</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit__________'><span class='texttt'>AssociatedUnit</span></span></a> <span class='keyword'>auto</span> u<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.obs-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.obs-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3152'>#</a></div><div class='texpara'><div id='qty.unit.obs-2.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>u</span><a class='hidden_link' href='#qty.unit.obs-2.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Unit,get_common_unit'><div id='lib:get_common_unit,Unit'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:get_common_unit,Unit'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit______________________________________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> get_common_unit<span class='parenthesis'>(</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_______________________________________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> us<span class='parenthesis'>)</span>
|
||
<span class='keyword'>requires</span> <i ><span class='texttt'>see below</span></i>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.obs-3'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.obs-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3164'>#</a></div><div class='texpara'><div id='qty.unit.obs-3.sentence-1' class='sentence'>Let
|
||
<ul class='itemize'><li id='qty.unit.obs-3.1'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.unit.obs-3.1'>(3.1)</a></div><span class='texttt'>u1</span> be <span class='texttt'>us<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='squarebracket'>[</span><span class='literal'>0</span><span class='squarebracket'>]</span></span>,</li><li id='qty.unit.obs-3.2'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.unit.obs-3.2'>(3.2)</a></div><span class='texttt'>u2</span> be <span class='texttt'>us<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='squarebracket'>[</span><span class='literal'>1</span><span class='squarebracket'>]</span></span>,</li><li id='qty.unit.obs-3.3'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.unit.obs-3.3'>(3.3)</a></div><span class='texttt'>U1</span> be <span class='texttt'><span class='keyword'>decltype</span><span class='parenthesis'>(</span>u1<span class='parenthesis'>)</span></span>,</li><li id='qty.unit.obs-3.4'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.unit.obs-3.4'>(3.4)</a></div><span class='texttt'>U2</span> be <span class='texttt'><span class='keyword'>decltype</span><span class='parenthesis'>(</span>u2<span class='parenthesis'>)</span></span>, and</li><li id='qty.unit.obs-3.5'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#qty.unit.obs-3.5'>(3.5)</a></div><span class='texttt'>rest</span> be a pack denoting the elements of <span class='texttt'>us</span> without <span class='texttt'>u1</span> and <span class='texttt'>u2</span><a class='hidden_link' href='#qty.unit.obs-3.sentence-1'>.</a></li></ul></div></div></div></div><div class='para' id='qty.unit.obs-4'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.obs-4'>4</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3179'>#</a></div><div class='texpara'><div id='qty.unit.obs-4.sentence-1' class='sentence'><i >Effects</i>: Equivalent to:
|
||
<span class='codeblock'><span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><span class='keyword'>sizeof</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>(</span>us<span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> <span class='literal'>1</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> u1;
|
||
<span class='keyword'>else</span> <span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><span class='keyword'>sizeof</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>(</span>us<span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> <span class='literal'>2</span><span class='parenthesis'>)</span> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><i >is-derived-from-specialization-of</i><span class='anglebracket'><</span>U1, common_unit<span class='anglebracket'>></span><span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>return</span> <i >TBD.</i>;
|
||
<span class='curlybracket'>}</span> <span class='keyword'>else</span> <span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><i >is-derived-from-specialization-of</i><span class='anglebracket'><</span>U2, common_unit<span class='anglebracket'>></span><span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> get_common_unit<span class='parenthesis'>(</span>u2, u1<span class='parenthesis'>)</span>;
|
||
<span class='keyword'>else</span> <span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span>std<span class='operator'>::</span>is_same_v<span class='anglebracket'><</span>U1, U2<span class='anglebracket'>></span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> u1;
|
||
<span class='keyword'>else</span> <span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span>equivalent<span class='parenthesis'>(</span>U1<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, U2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span>std<span class='operator'>::</span>derived_from<span class='anglebracket'><</span>U1, <span class='keyword'>typename</span> U2<span class='operator'>::</span><i >base-type</i><span class='anglebracket'>></span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> u1;
|
||
<span class='keyword'>else</span> <span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span>std<span class='operator'>::</span>derived_from<span class='anglebracket'><</span>U2, <span class='keyword'>typename</span> U1<span class='operator'>::</span><i >base-type</i><span class='anglebracket'>></span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> u2;
|
||
<span class='keyword'>else</span>
|
||
<span class='keyword'>return</span> std<span class='operator'>::</span>conditional_t<span class='anglebracket'><</span><i >type-less-impl</i><span class='anglebracket'><</span>U1, U2<span class='anglebracket'>></span><span class='parenthesis'>(</span><span class='parenthesis'>)</span>, U1, U2<span class='anglebracket'>></span><span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
<span class='curlybracket'>}</span> <span class='keyword'>else</span> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>constexpr</span> <span class='keyword'>auto</span> canonical_lhs <span class='operator'>=</span> <i >get-canonical-unit</i><span class='parenthesis'>(</span>U1<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>;
|
||
<span class='keyword'>constexpr</span> <span class='keyword'>auto</span> canonical_rhs <span class='operator'>=</span> <i >get-canonical-unit</i><span class='parenthesis'>(</span>U2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><i >is-positive-integral-power</i><span class='parenthesis'>(</span>canonical_lhs<span class='operator'>.</span>mag <span class='operator'>/</span> canonical_rhs<span class='operator'>.</span>mag<span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> u2;
|
||
<span class='keyword'>else</span> <span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><i >is-positive-integral-power</i><span class='parenthesis'>(</span>canonical_rhs<span class='operator'>.</span>mag <span class='operator'>/</span> canonical_lhs<span class='operator'>.</span>mag<span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> u1;
|
||
<span class='keyword'>else</span> <span class='curlybracket'>{</span>
|
||
<span class='keyword'>if</span> <span class='keyword'>constexpr</span> <span class='parenthesis'>(</span><i >type-less</i><span class='anglebracket'><</span>U1, U2<span class='anglebracket'>></span><span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>return</span> common_unit<span class='anglebracket'><</span>U1, U2<span class='anglebracket'>></span><span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
<span class='keyword'>else</span>
|
||
<span class='keyword'>return</span> common_unit<span class='anglebracket'><</span>U2, U1<span class='anglebracket'>></span><span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
<span class='curlybracket'>}</span>
|
||
<span class='curlybracket'>}</span>
|
||
<span class='curlybracket'>}</span> <span class='keyword'>else</span>
|
||
<span class='keyword'>return</span> get_common_unit<span class='parenthesis'>(</span>get_common_unit<span class='parenthesis'>(</span>u1, u2<span class='parenthesis'>)</span>, rest<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>)</span>;
|
||
</span></div></div></div></div><div class='para' id='qty.unit.obs-5'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.obs-5'>5</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3218'>#</a></div><div class='texpara'><div id='qty.unit.obs-5.sentence-1' class='sentence'><i >Remarks</i>: The expression in the <span class='textsf'><i >requires-clause</i></span> is equivalent to:
|
||
<span class='codeblock'><span class='parenthesis'>(</span><span class='keyword'>sizeof</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>(</span>us<span class='parenthesis'>)</span> <span class='operator'>!</span><span class='operator'>=</span> <span class='literal'>0</span> <span class='operator'>&</span><span class='operator'>&</span> <span class='parenthesis'>(</span><span class='keyword'>sizeof</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>(</span>us<span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> <span class='literal'>1</span> <span class='operator'>|</span><span class='operator'>|</span> <span class='comment'>//</span>
|
||
<span class='parenthesis'>(</span><span class='keyword'>sizeof</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>(</span>us<span class='parenthesis'>)</span> <span class='operator'>=</span><span class='operator'>=</span> <span class='literal'>2</span> <span class='operator'>&</span><span class='operator'>&</span> convertible<span class='parenthesis'>(</span>U1<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, U2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span> <span class='operator'>|</span><span class='operator'>|</span>
|
||
<span class='keyword'>requires</span> <span class='curlybracket'>{</span> get_common_unit<span class='parenthesis'>(</span>get_common_unit<span class='parenthesis'>(</span>u1, u2<span class='parenthesis'>)</span>, rest<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>)</span>; <span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
</span></div></div></div></div></div><div id='assoc.qty' class='section'><h4 ><a class='secnum' href='#assoc.qty' style='min-width:95pt'>5.4.4.9</a> Associated quantity <a class='abbr_ref' href='assoc.qty.html'>[assoc.qty]</a></h4><div class='texpara'><div id='lib:has-associated-quantity,Unit'><div id='lib:Unit,has-associated-quantity'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:Unit,has-associated-quantity'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit________________________________________________________________________'><span class='texttt'>Unit</span></span></a> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>consteval</span> <span class='keyword'>bool</span> <span class='texttt'><i >has-associated-quantity</i></span><span class='parenthesis'>(</span>U<span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
</code></div></div></div></div><div class='para' id='assoc.qty-1'><div class='marginalizedparent'><a class='marginalized' href='#assoc.qty-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3237'>#</a></div><div class='texpara'><div id='assoc.qty-1.sentence-1' class='sentence'><i >Returns</i>: <ul class='itemize'><li id='assoc.qty-1.1'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#assoc.qty-1.1'>(1.1)</a></div><div class='texpara'><div id='assoc.qty-1.1.sentence-1' class='sentence'>If <span class='texttt'>U<span class='operator'>​::​</span><span class='texttt'><i >quantity-spec</i></span></span> is a valid expression,
|
||
returns <span class='texttt'><span class='literal'>true</span></span><a class='hidden_link' href='#assoc.qty-1.1.sentence-1'>.</a></div></div></li><li id='assoc.qty-1.2'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#assoc.qty-1.2'>(1.2)</a></div><div class='texpara'><div id='assoc.qty-1.2.sentence-1' class='sentence'>Otherwise, if <span class='texttt'>U<span class='operator'>​::​</span><span class='texttt'><i >reference-unit</i></span></span> is a valid expression,
|
||
returns
|
||
<span class='codeblock'><i >has-associated-quantity</i><span class='parenthesis'>(</span>U<span class='operator'>::</span><i >reference-unit</i><span class='parenthesis'>)</span>
|
||
</span></div></div></li><li id='assoc.qty-1.3'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#assoc.qty-1.3'>(1.3)</a></div><div class='texpara'><div id='assoc.qty-1.3.sentence-1' class='sentence'>Otherwise, if
|
||
<span class='texttt'><span class='texttt'><i >is-derived-from-specialization-of</i></span><span class='anglebracket'><</span>U, <span class='texttt'><i >expr-fractions</i></span><span class='anglebracket'>></span><span class='parenthesis'>(</span><span class='parenthesis'>)</span></span>
|
||
is <span class='texttt'><span class='literal'>true</span></span>,
|
||
let <span class='texttt'>Nums</span> and <span class='texttt'>Dens</span>
|
||
be packs denoting the template arguments of
|
||
<span class='texttt'>U<span class='operator'>​::​</span><span class='texttt'><i >nums</i></span></span> and <span class='texttt'>U<span class='operator'>​::​</span><span class='texttt'><i >dens</i></span></span>, respectively<a class='hidden_link' href='#assoc.qty-1.3.sentence-1'>.</a></div> <div id='assoc.qty-1.3.sentence-2' class='sentence'>Returns
|
||
<span class='codeblock'><span class='parenthesis'>(</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> <span class='operator'>&</span><span class='operator'>&</span> <i >has-associated-quantity</i><span class='parenthesis'>(</span><i >expr-type</i><span class='anglebracket'><</span>Nums<span class='anglebracket'>></span><span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span> <span class='operator'>&</span><span class='operator'>&</span>
|
||
<span class='parenthesis'>(</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> <span class='operator'>&</span><span class='operator'>&</span> <i >has-associated-quantity</i><span class='parenthesis'>(</span><i >expr-type</i><span class='anglebracket'><</span>Dens<span class='anglebracket'>></span><span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
|
||
</span></div></div></li><li id='assoc.qty-1.4'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#assoc.qty-1.4'>(1.4)</a></div><div class='texpara'><div id='assoc.qty-1.4.sentence-1' class='sentence'>Otherwise, returns <span class='texttt'><span class='literal'>false</span></span><a class='hidden_link' href='#assoc.qty-1.4.sentence-1'>.</a></div></div></li></ul></div></div></div></div><div class='texpara'><div id='lib:get-associated-quantity,AssociatedUnit'><div id='lib:AssociatedUnit,get-associated-quantity'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:AssociatedUnit,get-associated-quantity'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit___________'><span class='texttt'>AssociatedUnit</span></span></a> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>consteval</span> <span class='keyword'>auto</span> <span class='texttt'><i >get-associated-quantity</i></span><span class='parenthesis'>(</span>U u<span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
</code></div></div></div></div><div class='para' id='assoc.qty-2'><div class='marginalizedparent'><a class='marginalized' href='#assoc.qty-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3273'>#</a></div><div class='texpara'><div id='assoc.qty-2.sentence-1' class='sentence'><i >Returns</i>: <ul class='itemize'><li id='assoc.qty-2.1'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#assoc.qty-2.1'>(2.1)</a></div>If <span class='texttt'>U</span> is of the form <span class='texttt'>common_<span class='shy'></span>unit<span class='anglebracket'><</span>Us<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>></span></span>,
|
||
returns
|
||
<span class='codeblock'>get_common_quantity_spec<span class='parenthesis'>(</span><i >get-associated-quantity</i><span class='parenthesis'>(</span>Us<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>)</span>
|
||
</span></li><li id='assoc.qty-2.2'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#assoc.qty-2.2'>(2.2)</a></div>Otherwise, if <span class='texttt'>U<span class='operator'>​::​</span><span class='texttt'><i >quantity-spec</i></span></span> is a valid expression,
|
||
returns
|
||
<span class='codeblock'><i >remove-kind</i><span class='parenthesis'>(</span>U<span class='operator'>::</span><i >quantity-spec</i><span class='parenthesis'>)</span>
|
||
</span></li><li id='assoc.qty-2.3'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#assoc.qty-2.3'>(2.3)</a></div>Otherwise, if <span class='texttt'>U<span class='operator'>​::​</span><span class='texttt'><i >reference-unit</i></span></span> is a valid expression,
|
||
returns
|
||
<span class='codeblock'><i >get-associated-quantity</i><span class='parenthesis'>(</span>U<span class='operator'>::</span><i >reference-unit</i><span class='parenthesis'>)</span>
|
||
</span></li><li id='assoc.qty-2.4'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#assoc.qty-2.4'>(2.4)</a></div>Otherwise, if
|
||
<span class='texttt'><span class='texttt'><i >is-derived-from-specialization-of</i></span><span class='anglebracket'><</span>U, <span class='texttt'><i >expr-fractions</i></span><span class='anglebracket'>></span><span class='parenthesis'>(</span><span class='parenthesis'>)</span></span>
|
||
is <span class='texttt'><span class='literal'>true</span></span>,
|
||
returns
|
||
<span class='codeblock'><i >expr-map</i><span class='anglebracket'><</span><i >to-quantity-spec</i>, derived_quantity_spec, <span class='keyword'>struct</span> dimensionless<span class='anglebracket'>></span><span class='parenthesis'>(</span>u<span class='parenthesis'>)</span>
|
||
</span>
|
||
where <span class='texttt'><i >to-quantity-spec</i></span> is defined as follows:
|
||
<span class='codeblock'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit____________'><span class='tcode_in_codeblock'>AssociatedUnit</span></span></a> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>using</span> <i >to-quantity-spec</i> <span class='operator'>=</span> <span class='keyword'>decltype</span><span class='parenthesis'>(</span><i >get-associated-quantity</i><span class='parenthesis'>(</span>U<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
|
||
</span></li></ul></div></div></div></div></div><div id='qty.unit.sym.fmt' class='section'><h4 ><a class='secnum' href='#qty.unit.sym.fmt' style='min-width:95pt'>5.4.4.10</a> Symbol formatting <a class='abbr_ref' href='qty.unit.sym.fmt.html'>[qty.unit.sym.fmt]</a></h4><div class='texpara'><div id='lib:Unit,unit_symbol_to'><div id='lib:unit_symbol_to,Unit'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:unit_symbol_to,Unit'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> CharT <span class='operator'>=</span> <span class='keyword'>char</span>, std<span class='operator'>::</span>output_iterator<span class='anglebracket'><</span>CharT<span class='anglebracket'>></span> Out, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_________________________________________________________________________'><span class='texttt'>Unit</span></span></a> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>constexpr</span> Out unit_symbol_to<span class='parenthesis'>(</span>Out out, U u, <span class='keyword'>const</span> unit_symbol_formatting<span class='operator'>&</span> fmt <span class='operator'>=</span> <span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.sym.fmt-1'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.sym.fmt-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3319'>#</a></div><div class='texpara'><div id='qty.unit.sym.fmt-1.sentence-1' class='sentence'><i >Effects</i>: TBD<a class='hidden_link' href='#qty.unit.sym.fmt-1.sentence-1'>.</a></div></div></div></div><div class='para' id='qty.unit.sym.fmt-2'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.sym.fmt-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3323'>#</a></div><div class='texpara'><div id='qty.unit.sym.fmt-2.sentence-1' class='sentence'><i >Returns</i>: TBD<a class='hidden_link' href='#qty.unit.sym.fmt-2.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:Unit,unit_symbol'><div id='lib:unit_symbol,Unit'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:unit_symbol,Unit'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span>unit_symbol_formatting fmt <span class='operator'>=</span> <span class='curlybracket'>{</span><span class='curlybracket'>}</span>, <span class='keyword'>typename</span> CharT <span class='operator'>=</span> <span class='keyword'>char</span>, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit__________________________________________________________________________'><span class='texttt'>Unit</span></span></a> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>consteval</span> std<span class='operator'>::</span>string_view unit_symbol<span class='parenthesis'>(</span>U<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='qty.unit.sym.fmt-3'><div class='marginalizedparent'><a class='marginalized' href='#qty.unit.sym.fmt-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3335'>#</a></div><div class='texpara'><div id='qty.unit.sym.fmt-3.sentence-1' class='sentence'><i >Effects</i>: Equivalent to:
|
||
<span class='codeblock'>TBD<span class='operator'>.</span>
|
||
</span></div></div></div></div></div></div><div id='concepts' class='section'><h3 ><a class='secnum' href='#concepts' style='min-width:80pt'>5.4.5</a> Concepts <a class='abbr_ref' href='qty.ref.concepts.html'>[qty.ref.concepts]</a></h3><div class='texpara'><div class='itemdecl' id='concept:Reference'><div class='marginalizedparent'><a class='itemDeclLink' href='#concept:Reference'>🔗</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> <a class='hidden_link' href='#concept:Reference' title='5.4.5 Concepts [qty.ref.concepts]'><span id='concept:Reference'><span id='lib:Reference'><span class='texttt'>Reference</span></span></span></a> <span class='operator'>=</span> <a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit_____________'><span class='texttt'>AssociatedUnit</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='texttt'><i >is-specialization-of</i></span><span class='anglebracket'><</span>T, reference<span class='anglebracket'>></span><span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>;
|
||
</code></div></div><div class='texpara'><div id='concepts-sentence-1' class='sentence'>A type <span class='texttt'>T</span> that satisfies <span class='texttt'>Reference</span>
|
||
represents the reference of a quantity (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-01">IEC 60050, 112-01-01</a>)<a class='hidden_link' href='#concepts-sentence-1'>.</a></div></div><div class='texpara'><div class='itemdecl' id='concept:ReferenceOf'><div class='marginalizedparent'><a class='itemDeclLink' href='#concept:ReferenceOf'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> T, <span class='keyword'>auto</span> QS<span class='anglebracket'>></span>
|
||
<span class='keyword'>concept</span> <a class='hidden_link' href='#concept:ReferenceOf' title='5.4.5 Concepts [qty.ref.concepts]'><span id='concept:ReferenceOf'><span id='lib:ReferenceOf'><span class='texttt'>ReferenceOf</span></span></span></a> <span class='operator'>=</span> <a href='#concept:Reference' title='5.4.5 Concepts [qty.ref.concepts]'><span id='conceptref:Reference___'><span class='texttt'>Reference</span></span></a><span class='anglebracket'><</span>T<span class='anglebracket'>></span> <span class='operator'>&</span><span class='operator'>&</span> <a href='#concept:QuantitySpecOf' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpecOf'><span class='texttt'>QuantitySpecOf</span></span></a><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>get_quantity_spec<span class='parenthesis'>(</span>T<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>, QS<span class='anglebracket'>></span>;
|
||
</code></div></div></div><div id='syn' class='section'><h3 ><a class='secnum' href='#syn' style='min-width:80pt'>5.4.6</a> Class template <span class='texttt'>reference</span> <a class='abbr_ref' href='qty.ref.syn.html'>[qty.ref.syn]</a></h3><div class='texpara'><span id='lib:reference,cbrt'><span id='lib:cbrt,reference'><span id='lib:reference,sqrt'><span id='lib:sqrt,reference'><span id='lib:reference,pow'><span id='lib:pow,reference'><span id='lib:reference,inverse'><span id='lib:inverse,reference'><span id='lib:AssociatedUnit,operator/'><span id='lib:operator/,AssociatedUnit'><span id='lib:reference,operator/'><span id='lib:operator/,reference'><span id='lib:AssociatedUnit,operator*'><span id='lib:operator*,AssociatedUnit'><span id='lib:reference,operator*'><span id='lib:operator*,reference'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator*,reference'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec_________________________________________________________'><span class='tcode_in_codeblock'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> Q, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit___________________________________________________________________________'><span class='tcode_in_codeblock'>Unit</span></span></a> <span class='keyword'>auto</span> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>using</span> <i >reference-t</i> <span class='operator'>=</span> reference<span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>Q<span class='parenthesis'>)</span>, <span class='keyword'>decltype</span><span class='parenthesis'>(</span>U<span class='parenthesis'>)</span><span class='anglebracket'>></span>; <span class='comment'>// <i >exposition only</i></span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec__________________________________________________________'><span class='tcode_in_codeblock'>QuantitySpec</span></span></a> Q, <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit____________________________________________________________________________'><span class='tcode_in_codeblock'>Unit</span></span></a> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>struct</span> <span id='lib:reference'><a class='hidden_link' href='#lib:reference' title='5.4.6 Class template reference [qty.ref.syn]'>reference</a></span> <span class='curlybracket'>{</span>
|
||
<span class='comment'>// <a href='#ops' title='5.4.7 Operations'>[qty.<span class='shy'></span>ref.<span class='shy'></span>ops]</a>, operations</span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Q2, <span class='keyword'>typename</span> U2<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span>reference, reference<span class='anglebracket'><</span>Q2, U2<span class='anglebracket'>></span><span class='parenthesis'>)</span>
|
||
<span class='operator'>-</span><span class='anglebracket'>></span> <i >reference-t</i><span class='anglebracket'><</span>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>*</span> Q2<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, U<span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>*</span> U2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit______________'><span class='tcode_in_codeblock'>AssociatedUnit</span></span></a> U2<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span>reference, U2<span class='parenthesis'>)</span>
|
||
<span class='operator'>-</span><span class='anglebracket'>></span> <i >reference-t</i><span class='anglebracket'><</span>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>*</span> get_quantity_spec<span class='parenthesis'>(</span>U2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>, U<span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>*</span> U2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit_______________'><span class='tcode_in_codeblock'>AssociatedUnit</span></span></a> U1<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span>U1, reference<span class='parenthesis'>)</span>
|
||
<span class='operator'>-</span><span class='anglebracket'>></span> <i >reference-t</i><span class='anglebracket'><</span>get_quantity_spec<span class='parenthesis'>(</span>U1<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span> <span class='operator'>*</span> Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, U1<span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>*</span> U<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Q2, <span class='keyword'>typename</span> U2<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>/</span><span class='parenthesis'>(</span>reference, reference<span class='anglebracket'><</span>Q2, U2<span class='anglebracket'>></span><span class='parenthesis'>)</span>
|
||
<span class='operator'>-</span><span class='anglebracket'>></span> <i >reference-t</i><span class='anglebracket'><</span>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>/</span> Q2<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, U<span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>/</span> U2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit________________'><span class='tcode_in_codeblock'>AssociatedUnit</span></span></a> U2<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>/</span><span class='parenthesis'>(</span>reference, U2<span class='parenthesis'>)</span>
|
||
<span class='operator'>-</span><span class='anglebracket'>></span> <i >reference-t</i><span class='anglebracket'><</span>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>/</span> get_quantity_spec<span class='parenthesis'>(</span>U2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>, U<span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>/</span> U2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit_________________'><span class='tcode_in_codeblock'>AssociatedUnit</span></span></a> U1<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>/</span><span class='parenthesis'>(</span>U1, reference<span class='parenthesis'>)</span>
|
||
<span class='operator'>-</span><span class='anglebracket'>></span> <i >reference-t</i><span class='anglebracket'><</span>get_quantity_spec<span class='parenthesis'>(</span>U1<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span> <span class='operator'>/</span> Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, U1<span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>/</span> U<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>></span>;
|
||
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>auto</span> inverse<span class='parenthesis'>(</span>reference<span class='parenthesis'>)</span> <span class='operator'>-</span><span class='anglebracket'>></span> <i >reference-t</i><span class='anglebracket'><</span>inverse<span class='parenthesis'>(</span>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>, inverse<span class='parenthesis'>(</span>U<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='anglebracket'>></span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span>std<span class='operator'>::</span>intmax_t Num, std<span class='operator'>::</span>intmax_t Den <span class='operator'>=</span> <span class='literal'>1</span><span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span>Den <span class='operator'>!</span><span class='operator'>=</span> <span class='literal'>0</span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>auto</span> pow<span class='parenthesis'>(</span>reference<span class='parenthesis'>)</span> <span class='operator'>-</span><span class='anglebracket'>></span> <i >reference-t</i><span class='anglebracket'><</span>pow<span class='anglebracket'><</span>Num, Den<span class='anglebracket'>></span><span class='parenthesis'>(</span>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>, pow<span class='anglebracket'><</span>Num, Den<span class='anglebracket'>></span><span class='parenthesis'>(</span>U<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='anglebracket'>></span>;
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>auto</span> sqrt<span class='parenthesis'>(</span>reference<span class='parenthesis'>)</span> <span class='operator'>-</span><span class='anglebracket'>></span> <i >reference-t</i><span class='anglebracket'><</span>sqrt<span class='parenthesis'>(</span>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>, sqrt<span class='parenthesis'>(</span>U<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='anglebracket'>></span>;
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>auto</span> cbrt<span class='parenthesis'>(</span>reference<span class='parenthesis'>)</span> <span class='operator'>-</span><span class='anglebracket'>></span> <i >reference-t</i><span class='anglebracket'><</span>cbrt<span class='parenthesis'>(</span>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>, cbrt<span class='parenthesis'>(</span>U<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='anglebracket'>></span>;
|
||
|
||
<span class='comment'>// <a href='#cmp' title='5.4.8 Comparison'>[qty.<span class='shy'></span>ref.<span class='shy'></span>cmp]</a>, comparison</span>
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Q2, <span class='keyword'>typename</span> U2<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> <span class='keyword'>operator</span><span class='operator'>=</span><span class='operator'>=</span><span class='parenthesis'>(</span>reference, reference<span class='anglebracket'><</span>Q2, U2<span class='anglebracket'>></span><span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit__________________'><span class='tcode_in_codeblock'>AssociatedUnit</span></span></a> U2<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> <span class='keyword'>operator</span><span class='operator'>=</span><span class='operator'>=</span><span class='parenthesis'>(</span>reference, U2 u2<span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Q2, <span class='keyword'>typename</span> U2<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> convertible<span class='parenthesis'>(</span>reference, reference<span class='anglebracket'><</span>Q2, U2<span class='anglebracket'>></span><span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit___________________'><span class='tcode_in_codeblock'>AssociatedUnit</span></span></a> U2<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> convertible<span class='parenthesis'>(</span>reference, U2 u2<span class='parenthesis'>)</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit____________________'><span class='tcode_in_codeblock'>AssociatedUnit</span></span></a> U1<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> convertible<span class='parenthesis'>(</span>U1 u1, reference<span class='parenthesis'>)</span>;
|
||
<span class='curlybracket'>}</span>;
|
||
|
||
<span class='curlybracket'>}</span>
|
||
</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div><div class='para' id='syn-1'><div class='marginalizedparent'><a class='marginalized' href='#syn-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3431'>#</a></div><div class='texpara'><div id='syn-1.sentence-1' class='sentence'><span class='texttt'>reference<span class='anglebracket'><</span>Q, U<span class='anglebracket'>></span></span> represents the reference of a quantity (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-01">IEC 60050, 112-01-01</a>)<a class='hidden_link' href='#syn-1.sentence-1'>.</a></div> <div id='syn-1.sentence-2' class='sentence'>The unit of measurement <span class='texttt'>U</span> (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-14">IEC 60050, 112-01-14</a>)
|
||
is used to measure a value of the quantity <span class='texttt'>Q</span> (<a href="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-28">IEC 60050, 112-01-28</a>)<a class='hidden_link' href='#syn-1.sentence-2'>.</a></div> <div id='syn-note-1' class='note'><div class='texpara'>[<i>Note <a href='#syn-note-1'>1</a></i>: <div id='syn-1.sentence-3' class='sentence'><span class='texttt'>reference</span> is typically implicitly instantiated
|
||
when specifying that a unit measures a more specific quantity<a class='hidden_link' href='#syn-1.sentence-3'>.</a></div> <div id='syn-example-1' class='example'><div class='texpara'>[<i>Example <a href='#syn-example-1'>1</a></i>: <span class='codeblock'><span class='keyword'>using</span> <span class='keyword'>namespace</span> si<span class='operator'>::</span>unit_symbols;
|
||
<span class='keyword'>auto</span> x <span class='operator'>=</span> <span class='literal'>1</span> <span class='operator'>*</span> m; <span class='comment'>// measures a length</span>
|
||
<span class='keyword'>auto</span> y <span class='operator'>=</span> <span class='literal'>1</span> <span class='operator'>*</span> isq<span class='operator'>::</span>width<span class='squarebracket'>[</span>m<span class='squarebracket'>]</span>; <span class='comment'>// measures a width</span>
|
||
<span class='keyword'>auto</span> z <span class='operator'>=</span> <span class='literal'>1</span> <span class='operator'>*</span> isq<span class='operator'>::</span>diameter<span class='squarebracket'>[</span>m<span class='squarebracket'>]</span>; <span class='comment'>// measures a diameter</span>
|
||
</span> — <i>end example</i>]</div></div> — <i>end note</i>]</div></div></div></div></div><div id='ops' class='section'><h3 ><a class='secnum' href='#ops' style='min-width:80pt'>5.4.7</a> Operations <a class='abbr_ref' href='qty.ref.ops.html'>[qty.ref.ops]</a></h3><div class='para' id='ops-1'><div class='marginalizedparent'><a class='marginalized' href='#ops-1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3450'>#</a></div><div class='texpara'><div id='ops-1.sentence-1' class='sentence'>Each member function with a <span class='textsf'><i >trailing-return-type</i></span>
|
||
of <span class='texttt'><span class='operator'>-</span><span class='anglebracket'>></span> <span class='texttt'><i >reference-t</i></span><span class='anglebracket'><</span>T<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>></span></span>
|
||
returns <span class='texttt'><span class='curlybracket'>{</span><span class='curlybracket'>}</span></span><a class='hidden_link' href='#ops-1.sentence-1'>.</a></div></div></div><div class='texpara'><div id='lib:Reference,operator*'><div id='lib:operator*,Reference'><div id='lib:Representation,operator*'><div id='lib:operator*,Representation'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator*,Representation'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> FwdRep, <a href='#concept:Reference' title='5.4.5 Concepts [qty.ref.concepts]'><span id='conceptref:Reference____'><span class='texttt'>Reference</span></span></a> R,
|
||
<a href='qty.rep.concepts.html#concept:RepresentationOf' title='5.5.4 Concepts [qty.rep.concepts]'><span id='conceptref:RepresentationOf'><span class='texttt'>RepresentationOf</span></span></a><span class='anglebracket'><</span>get_quantity_spec<span class='parenthesis'>(</span>R<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='anglebracket'>></span> Rep <span class='operator'>=</span> std<span class='operator'>::</span>remove_cvref_t<span class='anglebracket'><</span>FwdRep<span class='anglebracket'>></span><span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span><span class='operator'>!</span><a class='index' id='conceptref:OffsetUnit'></a><span class='texttt'><i >OffsetUnit</i></span><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>get_unit<span class='parenthesis'>(</span>R<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='anglebracket'>></span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>constexpr</span> quantity<span class='anglebracket'><</span>R<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Rep<span class='anglebracket'>></span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span>FwdRep<span class='operator'>&</span><span class='operator'>&</span> lhs, R r<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div></div></div><div class='para' id='ops-2'><div class='marginalizedparent'><a class='marginalized' href='#ops-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3465'>#</a></div><div class='texpara'><div id='ops-2.sentence-1' class='sentence'><i >Effects</i>: Equivalent to:
|
||
<span class='texttt'><span class='keyword'>return</span> quantity<span class='curlybracket'>{</span>std<span class='operator'>​::​</span>forward<span class='anglebracket'><</span>FwdRep<span class='anglebracket'>></span><span class='parenthesis'>(</span>lhs<span class='parenthesis'>)</span>, r<span class='curlybracket'>}</span>;</span></div></div></div></div><div class='texpara'><div id='lib:Reference,operator*_'><div id='lib:operator*,Reference_'><div id='lib:Representation,operator*_'><div id='lib:operator*,Representation_'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator*,Representation_'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> FwdRep, <a href='#concept:Reference' title='5.4.5 Concepts [qty.ref.concepts]'><span id='conceptref:Reference_____'><span class='texttt'>Reference</span></span></a> R,
|
||
<a href='qty.rep.concepts.html#concept:RepresentationOf' title='5.5.4 Concepts [qty.rep.concepts]'><span id='conceptref:RepresentationOf_'><span class='texttt'>RepresentationOf</span></span></a><span class='anglebracket'><</span>get_quantity_spec<span class='parenthesis'>(</span>R<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='anglebracket'>></span> Rep <span class='operator'>=</span> std<span class='operator'>::</span>remove_cvref_t<span class='anglebracket'><</span>FwdRep<span class='anglebracket'>></span><span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span><span class='parenthesis'>(</span><span class='operator'>!</span><a class='index' id='conceptref:OffsetUnit_'></a><span class='texttt'><i >OffsetUnit</i></span><span class='anglebracket'><</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>get_unit<span class='parenthesis'>(</span>R<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='anglebracket'>></span><span class='parenthesis'>)</span>
|
||
<span class='keyword'>constexpr</span> <a href='qty.syn.html#concept:Quantity' title='5.6.3 Class template quantity [qty.syn]'><span id='conceptref:Quantity____'><span class='texttt'>Quantity</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>/</span><span class='parenthesis'>(</span>FwdRep<span class='operator'>&</span><span class='operator'>&</span> lhs, R<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div></div></div><div class='para' id='ops-3'><div class='marginalizedparent'><a class='marginalized' href='#ops-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3481'>#</a></div><div class='texpara'><div id='ops-3.sentence-1' class='sentence'><i >Effects</i>: Equivalent to:
|
||
<span class='texttt'><span class='keyword'>return</span> quantity<span class='curlybracket'>{</span>std<span class='operator'>​::​</span>forward<span class='anglebracket'><</span>FwdRep<span class='anglebracket'>></span><span class='parenthesis'>(</span>lhs<span class='parenthesis'>)</span>, inverse<span class='parenthesis'>(</span>R<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='curlybracket'>}</span>;</span></div></div></div></div><div class='texpara'><div id='lib:Reference,operator/'><div id='lib:operator/,Reference'><div id='lib:quantity,operator/'><div id='lib:operator/,quantity'><div id='lib:Reference,operator*__'><div id='lib:operator*,Reference__'><div id='lib:quantity,operator*'><div id='lib:operator*,quantity'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator*,quantity'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> FwdQ, <a href='#concept:Reference' title='5.4.5 Concepts [qty.ref.concepts]'><span id='conceptref:Reference______'><span class='texttt'>Reference</span></span></a> R, <a href='qty.syn.html#concept:Quantity' title='5.6.3 Class template quantity [qty.syn]'><span id='conceptref:Quantity_____'><span class='texttt'>Quantity</span></span></a> Q <span class='operator'>=</span> std<span class='operator'>::</span>remove_cvref_t<span class='anglebracket'><</span>FwdQ<span class='anglebracket'>></span><span class='anglebracket'>></span>
|
||
<span class='keyword'>constexpr</span> <a href='qty.syn.html#concept:Quantity' title='5.6.3 Class template quantity [qty.syn]'><span id='conceptref:Quantity______'><span class='texttt'>Quantity</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span>FwdQ<span class='operator'>&</span><span class='operator'>&</span> q, R<span class='parenthesis'>)</span>;
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> FwdQ, <a href='#concept:Reference' title='5.4.5 Concepts [qty.ref.concepts]'><span id='conceptref:Reference_______'><span class='texttt'>Reference</span></span></a> R, <a href='qty.syn.html#concept:Quantity' title='5.6.3 Class template quantity [qty.syn]'><span id='conceptref:Quantity_______'><span class='texttt'>Quantity</span></span></a> Q <span class='operator'>=</span> std<span class='operator'>::</span>remove_cvref_t<span class='anglebracket'><</span>FwdQ<span class='anglebracket'>></span><span class='anglebracket'>></span>
|
||
<span class='keyword'>constexpr</span> <a href='qty.syn.html#concept:Quantity' title='5.6.3 Class template quantity [qty.syn]'><span id='conceptref:Quantity________'><span class='texttt'>Quantity</span></span></a> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>/</span><span class='parenthesis'>(</span>FwdQ<span class='operator'>&</span><span class='operator'>&</span> q, R<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div></div></div></div></div></div></div><div class='para' id='ops-4'><div class='marginalizedparent'><a class='marginalized' href='#ops-4'>4</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3499'>#</a></div><div class='texpara'><div id='ops-4.sentence-1' class='sentence'>Let <span class='texttt'>@</span> be the <span class='textsf'><i >operator</i></span><a class='hidden_link' href='#ops-4.sentence-1'>.</a></div></div></div></div><div class='para' id='ops-5'><div class='marginalizedparent'><a class='marginalized' href='#ops-5'>5</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3502'>#</a></div><div class='texpara'><div id='ops-5.sentence-1' class='sentence'><i >Effects</i>: Equivalent to:
|
||
<span class='codeblock'><span class='keyword'>return</span> quantity<span class='curlybracket'>{</span>std<span class='operator'>::</span>forward<span class='anglebracket'><</span>FwdQ<span class='anglebracket'>></span><span class='parenthesis'>(</span>q<span class='parenthesis'>)</span><span class='operator'>.</span><i >numerical-value</i>, Q<span class='operator'>::</span>reference @ R<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='curlybracket'>}</span>;
|
||
</span></div></div></div></div><div class='texpara'><div class='itemdecl' id='ops-itemdecl:4'><div class='marginalizedparent'><a class='itemDeclLink' href='#ops-itemdecl:4'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Reference' title='5.4.5 Concepts [qty.ref.concepts]'><span id='conceptref:Reference________'><span class='texttt'>Reference</span></span></a> R, <span class='keyword'>typename</span> Rep<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span> <a href='qty.rep.concepts.html#concept:RepresentationOf' title='5.5.4 Concepts [qty.rep.concepts]'><span id='conceptref:RepresentationOf__'><span class='texttt'>RepresentationOf</span></span></a><span class='anglebracket'><</span>std<span class='operator'>::</span>remove_cvref_t<span class='anglebracket'><</span>Rep<span class='anglebracket'>></span>, get_quantity_spec<span class='parenthesis'>(</span>R<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='anglebracket'>></span>
|
||
<span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span>R, Rep<span class='operator'>&</span><span class='operator'>&</span><span class='parenthesis'>)</span> <span class='operator'>=</span> <span class='keyword'>delete</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Reference' title='5.4.5 Concepts [qty.ref.concepts]'><span id='conceptref:Reference_________'><span class='texttt'>Reference</span></span></a> R, <span class='keyword'>typename</span> Rep<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span> <a href='qty.rep.concepts.html#concept:RepresentationOf' title='5.5.4 Concepts [qty.rep.concepts]'><span id='conceptref:RepresentationOf___'><span class='texttt'>RepresentationOf</span></span></a><span class='anglebracket'><</span>std<span class='operator'>::</span>remove_cvref_t<span class='anglebracket'><</span>Rep<span class='anglebracket'>></span>, get_quantity_spec<span class='parenthesis'>(</span>R<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span><span class='anglebracket'>></span>
|
||
<span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>/</span><span class='parenthesis'>(</span>R, Rep<span class='operator'>&</span><span class='operator'>&</span><span class='parenthesis'>)</span> <span class='operator'>=</span> <span class='keyword'>delete</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Reference' title='5.4.5 Concepts [qty.ref.concepts]'><span id='conceptref:Reference__________'><span class='texttt'>Reference</span></span></a> R, <span class='keyword'>typename</span> Q<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span> <a href='qty.syn.html#concept:Quantity' title='5.6.3 Class template quantity [qty.syn]'><span id='conceptref:Quantity_________'><span class='texttt'>Quantity</span></span></a><span class='anglebracket'><</span>std<span class='operator'>::</span>remove_cvref_t<span class='anglebracket'><</span>Q<span class='anglebracket'>></span><span class='anglebracket'>></span>
|
||
<span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>*</span><span class='parenthesis'>(</span>R, Q<span class='operator'>&</span><span class='operator'>&</span><span class='parenthesis'>)</span> <span class='operator'>=</span> <span class='keyword'>delete</span>;
|
||
|
||
<span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Reference' title='5.4.5 Concepts [qty.ref.concepts]'><span id='conceptref:Reference___________'><span class='texttt'>Reference</span></span></a> R, <span class='keyword'>typename</span> Q<span class='anglebracket'>></span>
|
||
<span class='keyword'>requires</span> <a href='qty.syn.html#concept:Quantity' title='5.6.3 Class template quantity [qty.syn]'><span id='conceptref:Quantity__________'><span class='texttt'>Quantity</span></span></a><span class='anglebracket'><</span>std<span class='operator'>::</span>remove_cvref_t<span class='anglebracket'><</span>Q<span class='anglebracket'>></span><span class='anglebracket'>></span>
|
||
<span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='operator'>/</span><span class='parenthesis'>(</span>R, Q<span class='operator'>&</span><span class='operator'>&</span><span class='parenthesis'>)</span> <span class='operator'>=</span> <span class='keyword'>delete</span>;
|
||
</code></div></div><div class='para' id='ops-6'><div class='marginalizedparent'><a class='marginalized' href='#ops-6'>6</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3529'>#</a></div><div class='texpara'><div id='ops-6.sentence-1' class='sentence'><i >Recommended practice</i>: Suggest swapping the operands<a class='hidden_link' href='#ops-6.sentence-1'>.</a></div></div></div></div></div><div id='cmp' class='section'><h3 ><a class='secnum' href='#cmp' style='min-width:80pt'>5.4.8</a> Comparison <a class='abbr_ref' href='qty.ref.cmp.html'>[qty.ref.cmp]</a></h3><div class='texpara'><div id='lib:reference,operator=='><div id='lib:operator==,reference'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator==,reference'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Q2, <span class='keyword'>typename</span> U2<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> <span class='keyword'>operator</span><span class='operator'>=</span><span class='operator'>=</span><span class='parenthesis'>(</span>reference, reference<span class='anglebracket'><</span>Q2, U2<span class='anglebracket'>></span><span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='cmp-1'><div class='marginalizedparent'><a class='marginalized' href='#cmp-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3543'>#</a></div><div class='texpara'><div id='cmp-1.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>=</span><span class='operator'>=</span> Q2<span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>&</span><span class='operator'>&</span> U<span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>=</span><span class='operator'>=</span> U2<span class='curlybracket'>{</span><span class='curlybracket'>}</span></span><a class='hidden_link' href='#cmp-1.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:AssociatedUnit,operator=='><div id='lib:operator==,AssociatedUnit'><div id='lib:reference,operator==_'><div id='lib:operator==,reference_'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator==,reference_'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit_____________________'><span class='texttt'>AssociatedUnit</span></span></a> U2<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> <span class='keyword'>operator</span><span class='operator'>=</span><span class='operator'>=</span><span class='parenthesis'>(</span>reference, U2 u2<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div></div></div><div class='para' id='cmp-2'><div class='marginalizedparent'><a class='marginalized' href='#cmp-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3556'>#</a></div><div class='texpara'><div id='cmp-2.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>=</span><span class='operator'>=</span> get_<span class='shy'></span>quantity_<span class='shy'></span>spec<span class='parenthesis'>(</span>u2<span class='parenthesis'>)</span> <span class='operator'>&</span><span class='operator'>&</span> U<span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>=</span><span class='operator'>=</span> u2</span><a class='hidden_link' href='#cmp-2.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:reference,convertible'><div id='lib:convertible,reference'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:convertible,reference'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Q2, <span class='keyword'>typename</span> U2<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> convertible<span class='parenthesis'>(</span>reference, reference<span class='anglebracket'><</span>Q2, U2<span class='anglebracket'>></span><span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='cmp-3'><div class='marginalizedparent'><a class='marginalized' href='#cmp-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3568'>#</a></div><div class='texpara'><div id='cmp-3.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>implicitly_<span class='shy'></span>convertible<span class='parenthesis'>(</span>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Q2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span> <span class='operator'>&</span><span class='operator'>&</span> convertible<span class='parenthesis'>(</span>U<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, U2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span></span><a class='hidden_link' href='#cmp-3.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:AssociatedUnit,convertible'><div id='lib:convertible,AssociatedUnit'><div id='lib:reference,convertible_'><div id='lib:convertible,reference_'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:convertible,reference_'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit______________________'><span class='texttt'>AssociatedUnit</span></span></a> U2<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> convertible<span class='parenthesis'>(</span>reference, U2 u2<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div></div></div><div class='para' id='cmp-4'><div class='marginalizedparent'><a class='marginalized' href='#cmp-4'>4</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3581'>#</a></div><div class='texpara'><div id='cmp-4.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>implicitly_<span class='shy'></span>convertible<span class='parenthesis'>(</span>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, get_<span class='shy'></span>quantity_<span class='shy'></span>spec<span class='parenthesis'>(</span>u2<span class='parenthesis'>)</span><span class='parenthesis'>)</span> <span class='operator'>&</span><span class='operator'>&</span> convertible<span class='parenthesis'>(</span>U<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, u2<span class='parenthesis'>)</span></span><a class='hidden_link' href='#cmp-4.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:AssociatedUnit,convertible_'><div id='lib:convertible,AssociatedUnit_'><div id='lib:reference,convertible__'><div id='lib:convertible,reference__'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:convertible,reference__'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit_______________________'><span class='texttt'>AssociatedUnit</span></span></a> U1<span class='anglebracket'>></span>
|
||
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <span class='keyword'>bool</span> convertible<span class='parenthesis'>(</span>U1 u1, reference<span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div></div></div><div class='para' id='cmp-5'><div class='marginalizedparent'><a class='marginalized' href='#cmp-5'>5</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3594'>#</a></div><div class='texpara'><div id='cmp-5.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>implicitly_<span class='shy'></span>convertible<span class='parenthesis'>(</span>get_<span class='shy'></span>quantity_<span class='shy'></span>spec<span class='parenthesis'>(</span>u1<span class='parenthesis'>)</span>, Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span> <span class='operator'>&</span><span class='operator'>&</span> convertible<span class='parenthesis'>(</span>u1, U<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span></span><a class='hidden_link' href='#cmp-5.sentence-1'>.</a></div></div></div></div></div><div id='obs' class='section'><h3 ><a class='secnum' href='#obs' style='min-width:80pt'>5.4.9</a> Observers <a class='abbr_ref' href='qty.ref.obs.html'>[qty.ref.obs]</a></h3><div class='texpara'><div id='lib:reference,get_quantity_spec'><div id='lib:get_quantity_spec,reference'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:get_quantity_spec,reference'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Q, <span class='keyword'>typename</span> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2 Concepts [qty.spec.concepts]'><span id='conceptref:QuantitySpec___________________________________________________________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> get_quantity_spec<span class='parenthesis'>(</span>reference<span class='anglebracket'><</span>Q, U<span class='anglebracket'>></span><span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='obs-1'><div class='marginalizedparent'><a class='marginalized' href='#obs-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3608'>#</a></div><div class='texpara'><div id='obs-1.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span></span><a class='hidden_link' href='#obs-1.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:reference,get_unit'><div id='lib:get_unit,reference'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:get_unit,reference'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><span class='keyword'>typename</span> Q, <span class='keyword'>typename</span> U<span class='anglebracket'>></span>
|
||
<span class='keyword'>consteval</span> <a href='#concept:Unit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:Unit_____________________________________________________________________________'><span class='texttt'>Unit</span></span></a> <span class='keyword'>auto</span> get_unit<span class='parenthesis'>(</span>reference<span class='anglebracket'><</span>Q, U<span class='anglebracket'>></span><span class='parenthesis'>)</span>;
|
||
</code></div></div></div></div><div class='para' id='obs-2'><div class='marginalizedparent'><a class='marginalized' href='#obs-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3620'>#</a></div><div class='texpara'><div id='obs-2.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>U<span class='curlybracket'>{</span><span class='curlybracket'>}</span></span><a class='hidden_link' href='#obs-2.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:AssociatedUnit,get_common_reference'><div id='lib:get_common_reference,AssociatedUnit'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:get_common_reference,AssociatedUnit'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>consteval</span> <a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit________________________'><span class='texttt'>AssociatedUnit</span></span></a> <span class='keyword'>auto</span> <span id='lib:get_common_reference'><a class='hidden_link' href='#lib:get_common_reference' title='5.4.9 Observers [qty.ref.obs]'>get_common_reference</a></span><span class='parenthesis'>(</span><a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit_________________________'><span class='texttt'>AssociatedUnit</span></span></a> <span class='keyword'>auto</span> u1,
|
||
<a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit__________________________'><span class='texttt'>AssociatedUnit</span></span></a> <span class='keyword'>auto</span> u2,
|
||
<a href='#concept:AssociatedUnit' title='5.4.4.4 Concepts [qty.unit.concepts]'><span id='conceptref:AssociatedUnit___________________________'><span class='texttt'>AssociatedUnit</span></span></a> <span class='keyword'>auto</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> rest<span class='parenthesis'>)</span>
|
||
<span class='keyword'>requires</span> <i ><span class='texttt'>see below</span></i>;
|
||
</code></div></div></div></div><div class='para' id='obs-3'><div class='marginalizedparent'><a class='marginalized' href='#obs-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3634'>#</a></div><div class='texpara'><div id='obs-3.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>get_<span class='shy'></span>common_<span class='shy'></span>unit<span class='parenthesis'>(</span>u1, u2, rest<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>)</span></span><a class='hidden_link' href='#obs-3.sentence-1'>.</a></div></div></div></div><div class='para' id='obs-4'><div class='marginalizedparent'><a class='marginalized' href='#obs-4'>4</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3638'>#</a></div><div class='texpara'><div id='obs-4.sentence-1' class='sentence'><i >Remarks</i>: The expression in the <span class='textsf'><i >requires-clause</i></span> is equivalent to:
|
||
<span class='codeblock'><span class='keyword'>requires</span> <span class='curlybracket'>{</span>
|
||
get_common_quantity_spec<span class='parenthesis'>(</span>get_quantity_spec<span class='parenthesis'>(</span>u1<span class='parenthesis'>)</span>, get_quantity_spec<span class='parenthesis'>(</span>u2<span class='parenthesis'>)</span>,
|
||
get_quantity_spec<span class='parenthesis'>(</span>rest<span class='parenthesis'>)</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>)</span>;
|
||
<span class='curlybracket'>{</span> get_common_unit<span class='parenthesis'>(</span>u1, u2, rest<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>)</span> <span class='curlybracket'>}</span> <span class='operator'>-</span><span class='anglebracket'>></span> AssociatedUnit;
|
||
<span class='curlybracket'>}</span>
|
||
</span></div></div></div></div><div class='texpara'><div id='lib:reference,get_common_reference'><div id='lib:get_common_reference,reference'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:get_common_reference,reference'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'><</span><a href='#concept:Reference' title='5.4.5 Concepts [qty.ref.concepts]'><span id='conceptref:Reference____________'><span class='texttt'>Reference</span></span></a> R1, <a href='#concept:Reference' title='5.4.5 Concepts [qty.ref.concepts]'><span id='conceptref:Reference_____________'><span class='texttt'>Reference</span></span></a> R2, <a href='#concept:Reference' title='5.4.5 Concepts [qty.ref.concepts]'><span id='conceptref:Reference______________'><span class='texttt'>Reference</span></span></a><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> Rest<span class='anglebracket'>></span>
|
||
<span class='keyword'>consteval</span> <a href='#concept:Reference' title='5.4.5 Concepts [qty.ref.concepts]'><span id='conceptref:Reference_______________'><span class='texttt'>Reference</span></span></a> <span class='keyword'>auto</span> <span id='lib:get_common_reference_'><a class='hidden_link' href='#lib:get_common_reference' title='5.4.9 Observers [qty.ref.obs]'>get_common_reference</a></span><span class='parenthesis'>(</span>R1 r1, R2 r2, Rest<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> rest<span class='parenthesis'>)</span>
|
||
<span class='keyword'>requires</span> <i ><span class='texttt'>see below</span></i>;
|
||
</code></div></div></div></div><div class='para' id='obs-5'><div class='marginalizedparent'><a class='marginalized' href='#obs-5'>5</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3658'>#</a></div><div class='texpara'><div id='obs-5.sentence-1' class='sentence'><i >Returns</i>: <span class='codeblock'><i >reference-t</i><span class='anglebracket'><</span>get_common_quantity_spec<span class='parenthesis'>(</span>get_quantity_spec<span class='parenthesis'>(</span>R1<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>, get_quantity_spec<span class='parenthesis'>(</span>R2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>,
|
||
get_quantity_spec<span class='parenthesis'>(</span>rest<span class='parenthesis'>)</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>)</span>,
|
||
get_common_unit<span class='parenthesis'>(</span>get_unit<span class='parenthesis'>(</span>R1<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>, get_unit<span class='parenthesis'>(</span>R2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='parenthesis'>)</span>, get_unit<span class='parenthesis'>(</span>rest<span class='parenthesis'>)</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>)</span><span class='anglebracket'>></span><span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
|
||
</span></div></div></div></div><div class='para' id='obs-6'><div class='marginalizedparent'><a class='marginalized' href='#obs-6'>6</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units329ffdaacb1bd7bed08565ac80d9eef7ccb1e5b5/source/quantities.tex#L3666'>#</a></div><div class='texpara'><div id='obs-6.sentence-1' class='sentence'><i >Remarks</i>: The expression in the <span class='textsf'><i >requires-clause</i></span> is equivalent to:
|
||
<span class='codeblock'><span class='keyword'>requires</span> <span class='curlybracket'>{</span>
|
||
get_common_quantity_spec<span class='parenthesis'>(</span>get_quantity_spec<span class='parenthesis'>(</span>r1<span class='parenthesis'>)</span>, get_quantity_spec<span class='parenthesis'>(</span>r2<span class='parenthesis'>)</span>,
|
||
get_quantity_spec<span class='parenthesis'>(</span>rest<span class='parenthesis'>)</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>)</span>;
|
||
get_common_unit<span class='parenthesis'>(</span>get_unit<span class='parenthesis'>(</span>r1<span class='parenthesis'>)</span>, get_unit<span class='parenthesis'>(</span>r2<span class='parenthesis'>)</span>, get_unit<span class='parenthesis'>(</span>rest<span class='parenthesis'>)</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='parenthesis'>)</span>;
|
||
<span class='curlybracket'>}</span>
|
||
</span></div></div></div></div></div></div></body></html> |