Files
mp-units/HEAD/api_reference/gen/qty.spec.html
T

306 lines
133 KiB
HTML

<!DOCTYPE html><html lang='en'><head><title>[qty.spec]</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' href='qty.ref.html#qty.spec'>[qty.ref]</a></h2><h3 ><a class='secnum' style='min-width:80pt'>5.4.3</a> Quantity specification <a class='abbr_ref'>[qty.spec]</a></h3><div id='general' class='section'><h4 ><a class='secnum' href='#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='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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L1564'>#</a></div><div class='texpara'><div id='general-1.sentence-1' class='sentence'>Subclause [qty.<span class='shy'></span>spec] 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='#general-1.sentence-1'>.</a></div></div></div></div><div id='concepts' class='section'><h4 ><a class='secnum' href='#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='concepts-itemdecl:1'><div class='marginalizedparent'><a class='itemDeclLink' href='#concepts-itemdecl:1'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'>&lt;</span><span class='keyword'>typename</span> T<span class='anglebracket'>&gt;</span>
<span class='keyword'>concept</span> <a class='hidden_link' href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[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'>&lt;</span>T<span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span> std<span class='operator'>::</span>derived_from<span class='anglebracket'>&lt;</span>T, <span class='texttt'><i >quantity-spec-interface</i></span><span class='anglebracket'>&gt;</span>;
<span class='keyword'>template</span><span class='anglebracket'>&lt;</span><span class='keyword'>typename</span> T<span class='anglebracket'>&gt;</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&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'>&lt;</span>T<span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span> <span class='texttt'><i >is-specialization-of</i></span><span class='anglebracket'>&lt;</span>T, kind_of_<span class='anglebracket'>&gt;</span><span class='parenthesis'>(</span><span class='parenthesis'>)</span>;
<span class='keyword'>template</span><span class='anglebracket'>&lt;</span><span class='keyword'>typename</span> T<span class='anglebracket'>&gt;</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&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec_'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'>&lt;</span>T<span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span> <span class='texttt'><i >is-derived-from-specialization-of</i></span><span class='anglebracket'>&lt;</span>T, quantity_spec<span class='anglebracket'>&gt;</span><span class='parenthesis'>(</span><span class='parenthesis'>)</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</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'>&lt;</span>T<span class='anglebracket'>&gt;</span><span class='parenthesis'>)</span>;
<span class='keyword'>template</span><span class='anglebracket'>&lt;</span><span class='keyword'>typename</span> T<span class='anglebracket'>&gt;</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&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec__'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'>&lt;</span>T<span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span>
<span class='parenthesis'>(</span><span class='texttt'><i >is-specialization-of</i></span><span class='anglebracket'>&lt;</span>T, derived_quantity_spec<span class='anglebracket'>&gt;</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'>&lt;</span>T<span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span>
<span class='texttt'><i >is-specialization-of</i></span><span class='anglebracket'>&lt;</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'>&gt;</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'>&lt;</span><span class='keyword'>auto</span> Child, <span class='keyword'>auto</span> Parent<span class='anglebracket'>&gt;</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'>&lt;</span><span class='keyword'>auto</span> To, <span class='keyword'>auto</span> From<span class='anglebracket'>&gt;</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&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec___'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'>&lt;</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>From<span class='parenthesis'>)</span><span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span> <a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec____'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'>&lt;</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>To<span class='parenthesis'>)</span><span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</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'>&amp;</span><span class='operator'>&amp;</span> <a class='index' id='conceptref:ChildQuantitySpecOf'></a><span class='texttt'><i >ChildQuantitySpecOf</i></span><span class='anglebracket'>&lt;</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'>&gt;</span>;
<span class='keyword'>template</span><span class='anglebracket'>&lt;</span><span class='keyword'>auto</span> From, <span class='keyword'>auto</span> To<span class='anglebracket'>&gt;</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&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec_____'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'>&lt;</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>From<span class='parenthesis'>)</span><span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span> <a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec______'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'>&lt;</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>To<span class='parenthesis'>)</span><span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span> implicitly_convertible<span class='parenthesis'>(</span>From, To<span class='parenthesis'>)</span>;
<span class='keyword'>template</span><span class='anglebracket'>&lt;</span><span class='keyword'>auto</span> From, <span class='keyword'>auto</span> To<span class='anglebracket'>&gt;</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&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec_______'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'>&lt;</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>From<span class='parenthesis'>)</span><span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span> <a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec________'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'>&lt;</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>To<span class='parenthesis'>)</span><span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span> explicitly_convertible<span class='parenthesis'>(</span>From, To<span class='parenthesis'>)</span>;
<span class='keyword'>template</span><span class='anglebracket'>&lt;</span><span class='keyword'>auto</span> From, <span class='keyword'>auto</span> To<span class='anglebracket'>&gt;</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&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec_________'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'>&lt;</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>From<span class='parenthesis'>)</span><span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span> <a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec__________'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'>&lt;</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>To<span class='parenthesis'>)</span><span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span> castable<span class='parenthesis'>(</span>From, To<span class='parenthesis'>)</span>;
<span class='keyword'>template</span><span class='anglebracket'>&lt;</span><span class='keyword'>typename</span> T, <span class='keyword'>auto</span> QS<span class='anglebracket'>&gt;</span>
<span class='keyword'>concept</span> <a class='hidden_link' href='#concept:QuantitySpecOf' title='5.4.3.2&emsp;Concepts&emsp;[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&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec___________'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'>&lt;</span>T<span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span> <a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec____________'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'>&lt;</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>QS<span class='parenthesis'>)</span><span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span> <a class='index' id='conceptref:QuantitySpecConvertibleTo'></a><span class='texttt'><i >QuantitySpecConvertibleTo</i></span><span class='anglebracket'>&lt;</span>T<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, QS<span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span>
<span class='operator'>!</span><a class='index' id='conceptref:NestedQuantityKindSpecOf'></a><span class='texttt'><i >NestedQuantityKindSpecOf</i></span><span class='anglebracket'>&lt;</span>T<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, QS<span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span>
<span class='parenthesis'>(</span><a class='index' id='conceptref:QuantityKindSpec__'></a><span class='texttt'><i >QuantityKindSpec</i></span><span class='anglebracket'>&lt;</span>T<span class='anglebracket'>&gt;</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'>&lt;</span>QS, T<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>&gt;</span><span class='parenthesis'>)</span>;
<span class='keyword'>template</span><span class='anglebracket'>&lt;</span><span class='keyword'>typename</span> T<span class='anglebracket'>&gt;</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&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec_____________'><span class='texttt'>QuantitySpec</span></span></a><span class='anglebracket'>&lt;</span>T<span class='anglebracket'>&gt;</span><span class='parenthesis'>)</span>; <span class='comment'>// <i >exposition only</i></span>
</code></div></div></div><div id='types' class='section'><h4 ><a class='secnum' href='#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'>&lt;</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'>&gt;</span>
<span class='keyword'>struct</span> quantity_spec<span class='anglebracket'>&lt;</span>Dim, Args<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>&gt;</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'>&lt;</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'>&gt;</span>
<span class='keyword'>struct</span> quantity_spec<span class='anglebracket'>&lt;</span>Eq, Args<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>&gt;</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='qty.dim.concepts.html#concept:Dimension' title='5.4.2.2&emsp;Concepts&emsp;[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'>&lt;</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'>&gt;</span>
<span class='keyword'>struct</span> quantity_spec<span class='anglebracket'>&lt;</span>QS, Args<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>&gt;</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='qty.dim.concepts.html#concept:Dimension' title='5.4.2.2&emsp;Concepts&emsp;[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'>&lt;</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'>&gt;</span>
<span class='keyword'>requires</span> <a class='index' id='conceptref:QuantitySpecExplicitlyConvertibleTo'></a><i >QuantitySpecExplicitlyConvertibleTo</i><span class='anglebracket'>&lt;</span>Eq, QS<span class='anglebracket'>&gt;</span>
<span class='keyword'>struct</span> quantity_spec<span class='anglebracket'>&lt;</span>QS, Eq, Args<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>&gt;</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='qty.dim.concepts.html#concept:Dimension' title='5.4.2.2&emsp;Concepts&emsp;[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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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&emsp;Named&emsp;[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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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&emsp;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'>&#x200b;::&#x200b;</span>real_<span class='shy'></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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L1719'>#</a></div><div class='texpara'><div id='named.qty-example-1' class='example'><div class='texpara'>[<i>Example&nbsp;<a href='#named.qty-example-1'>1</a></i>:&ensp;<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'>&lt;</span>dim_length<span class='anglebracket'>&gt;</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'>&lt;</span>pow<span class='anglebracket'>&lt;</span><span class='literal'>2</span><span class='anglebracket'>&gt;</span><span class='parenthesis'>(</span>length<span class='parenthesis'>)</span><span class='anglebracket'>&gt;</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'>&lt;</span>length<span class='anglebracket'>&gt;</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'>&lt;</span>dimensionless, arc_length <span class='operator'>/</span> radius, is_kind<span class='anglebracket'>&gt;</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> —&nbsp;<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'>&lt;</span><i >NamedQuantitySpec</i><a class='index' id='concept:NamedQuantitySpec_'></a> Q<span class='anglebracket'>&gt;</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'>&lt;</span><span class='keyword'>typename</span><span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span> Expr<span class='anglebracket'>&gt;</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'>&lt;</span><span class='keyword'>struct</span> dimensionless, Expr<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>&gt;</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'>&lt;</span><span class='keyword'>struct</span> dimensionless, Expr<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>&gt;</span>;
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <a href='qty.dim.concepts.html#concept:Dimension' title='5.4.2.2&emsp;Concepts&emsp;[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'>&lt;</span><i >to-dimension</i>, derived_dimension, <span class='keyword'>struct</span> dimension_one<span class='anglebracket'>&gt;</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'>&lt;</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'>&gt;</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'>&lt;</span>Expr<span class='operator'>.</span><span class='operator'>.</span><span class='operator'>.</span><span class='anglebracket'>&gt;</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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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&nbsp;<a href='#derived.qty-example-1'>1</a></i>:&ensp;<span class='codeblock'><span class='keyword'>constexpr</span> <span class='keyword'>auto</span> area <span class='operator'>=</span> pow<span class='anglebracket'>&lt;</span><span class='literal'>2</span><span class='anglebracket'>&gt;</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&lt;power&lt;isq&#x200b;::&#x200b;length, 2&gt;&gt;</span></span>
</span> —&nbsp;<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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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'>&#x200b;::&#x200b;</span><span class='texttt'><i >nums</i></span></span> and <span class='texttt'><span class='texttt'><i >base</i></span><span class='operator'>&#x200b;::&#x200b;</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>real_scalar, <i >expr-type</i><span class='anglebracket'>&lt;</span>Pack<span class='anglebracket'>&gt;</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'>&#x200b;::&#x200b;</span>real_<span class='shy'></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'>&#x200b;::&#x200b;</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'>&lt;</span>derived_quantity_spec<span class='anglebracket'>&lt;</span><span class='anglebracket'>&gt;</span><span class='anglebracket'>&gt;</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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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'>&lt;</span><a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec______________'><span class='tcode_in_codeblock'>QuantitySpec</span></span></a> Q<span class='anglebracket'>&gt;</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'>&lt;</span>Q<span class='anglebracket'>&gt;</span><span class='parenthesis'>)</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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'>&lt;</span>Q<span class='anglebracket'>&gt;</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='utils' class='section'><h4 ><a class='secnum' href='#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'>&lt;</span><a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[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&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec________________'><span class='texttt'>QuantitySpec</span></span></a> Q<span class='anglebracket'>&gt;</span>
<span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[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='utils-1'><div class='marginalizedparent'><a class='marginalized' href='#utils-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L1844'>#</a></div><div class='texpara'><div id='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'>&amp;</span><span class='operator'>&amp;</span> <a class='index' id='conceptref:QuantityKindSpec____'></a><i >QuantityKindSpec</i><span class='anglebracket'>&lt;</span><span class='keyword'>decltype</span><span class='parenthesis'>(</span>From<span class='parenthesis'>)</span><span class='anglebracket'>&gt;</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>
<span class='keyword'>return</span> kind_of<span class='anglebracket'>&lt;</span>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>&gt;</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'>&lt;</span><a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec__________________'><span class='texttt'>QuantitySpec</span></span></a> Q<span class='anglebracket'>&gt;</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='utils-2'><div class='marginalizedparent'><a class='marginalized' href='#utils-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L1862'>#</a></div><div class='texpara'><div id='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'>&lt;</span>Q<span class='anglebracket'>&gt;</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'>&lt;</span><a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec___________________'><span class='texttt'>QuantitySpec</span></span></a> QS, <a href='qty.unit.concepts.html#concept:Unit' title='5.4.4.4&emsp;Concepts&emsp;[qty.unit.concepts]'><span id='conceptref:Unit'><span class='texttt'>Unit</span></span></a> U<span class='anglebracket'>&gt;</span>
<span class='keyword'>requires</span><span class='parenthesis'>(</span><span class='operator'>!</span><a href='qty.unit.concepts.html#concept:AssociatedUnit' title='5.4.4.4&emsp;Concepts&emsp;[qty.unit.concepts]'><span id='conceptref:AssociatedUnit'><span class='texttt'>AssociatedUnit</span></span></a><span class='anglebracket'>&lt;</span>U<span class='anglebracket'>&gt;</span><span class='parenthesis'>)</span> <span class='operator'>|</span><span class='operator'>|</span> <a href='qty.unit.concepts.html#concept:UnitOf' title='5.4.4.4&emsp;Concepts&emsp;[qty.unit.concepts]'><span id='conceptref:UnitOf'><span class='texttt'>UnitOf</span></span></a><span class='anglebracket'>&lt;</span>U, QS<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>&gt;</span>
<span class='keyword'>consteval</span> <a href='qty.ref.concepts.html#concept:Reference' title='5.4.5&emsp;Concepts&emsp;[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='utils-3'><div class='marginalizedparent'><a class='marginalized' href='#utils-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L1882'>#</a></div><div class='texpara'><div id='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'>&lt;</span>QS, U<span class='anglebracket'>&gt;</span><span class='curlybracket'>{</span><span class='curlybracket'>}</span>;
</span></div></div></div></div></div><div id='ops' class='section'><h4 ><a class='secnum' href='#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'>&lt;</span><a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[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&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec_____________________'><span class='tcode_in_codeblock'>QuantitySpec</span></span></a> Rhs<span class='anglebracket'>&gt;</span>
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[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'>&lt;</span><a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[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&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec________________________'><span class='tcode_in_codeblock'>QuantitySpec</span></span></a> Rhs<span class='anglebracket'>&gt;</span>
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[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'>&lt;</span><span class='keyword'>typename</span> Self, <a href='qty.unit.concepts.html#concept:UnitOf' title='5.4.4.4&emsp;Concepts&emsp;[qty.unit.concepts]'><span id='conceptref:UnitOf_'><span class='tcode_in_codeblock'>UnitOf</span></span></a><span class='anglebracket'>&lt;</span>Self<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>&gt;</span> U<span class='anglebracket'>&gt;</span>
<span class='keyword'>consteval</span> <a href='qty.ref.concepts.html#concept:Reference' title='5.4.5&emsp;Concepts&emsp;[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'>&lt;</span><span class='keyword'>typename</span> Self, <span class='keyword'>typename</span> FwdQ, <a href='qty.syn.html#concept:Quantity' title='5.6.3&emsp;Class template quantity&emsp;[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'>&lt;</span>FwdQ<span class='anglebracket'>&gt;</span><span class='anglebracket'>&gt;</span>
<span class='keyword'>requires</span> <a class='index' id='conceptref:QuantitySpecExplicitlyConvertibleTo_'></a><i >QuantitySpecExplicitlyConvertibleTo</i><span class='anglebracket'>&lt;</span>Q<span class='operator'>::</span>quantity_spec, Self<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>&gt;</span>
<span class='keyword'>constexpr</span> <a href='qty.syn.html#concept:Quantity' title='5.6.3&emsp;Class template quantity&emsp;[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'>&amp;</span><span class='operator'>&amp;</span> q<span class='parenthesis'>)</span>;
<span class='keyword'>template</span><span class='anglebracket'>&lt;</span><a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[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&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec___________________________'><span class='tcode_in_codeblock'>QuantitySpec</span></span></a> Rhs<span class='anglebracket'>&gt;</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'>&lt;</span><a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec____________________________'><span class='texttt'>QuantitySpec</span></span></a> Lhs, <a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec_____________________________'><span class='texttt'>QuantitySpec</span></span></a> Rhs<span class='anglebracket'>&gt;</span>
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[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='ops-1'><div class='marginalizedparent'><a class='marginalized' href='#ops-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L1927'>#</a></div><div class='texpara'><div id='ops-1.sentence-1' class='sentence'><i >Returns</i>: <span class='codeblock'><i >clone-kind-of</i><span class='anglebracket'>&lt;</span>Lhs<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Rhs<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>&gt;</span><span class='parenthesis'>(</span><i >expr-multiply</i><span class='anglebracket'>&lt;</span>derived_quantity_spec, <span class='keyword'>struct</span> dimensionless<span class='anglebracket'>&gt;</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'>&lt;</span><a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec_______________________________'><span class='texttt'>QuantitySpec</span></span></a> Lhs, <a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec________________________________'><span class='texttt'>QuantitySpec</span></span></a> Rhs<span class='anglebracket'>&gt;</span>
<span class='keyword'>friend</span> <span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[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='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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L1942'>#</a></div><div class='texpara'><div id='ops-2.sentence-1' class='sentence'><i >Returns</i>: <span class='codeblock'><i >clone-kind-of</i><span class='anglebracket'>&lt;</span>Lhs<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Rhs<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>&gt;</span><span class='parenthesis'>(</span><i >expr-divide</i><span class='anglebracket'>&lt;</span>derived_quantity_spec, <span class='keyword'>struct</span> dimensionless<span class='anglebracket'>&gt;</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'>&lt;</span><span class='keyword'>typename</span> Self, <a href='qty.unit.concepts.html#concept:UnitOf' title='5.4.4.4&emsp;Concepts&emsp;[qty.unit.concepts]'><span id='conceptref:UnitOf__'><span class='texttt'>UnitOf</span></span></a><span class='anglebracket'>&lt;</span>Self<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>&gt;</span> U<span class='anglebracket'>&gt;</span>
<span class='keyword'>consteval</span> <a href='qty.ref.concepts.html#concept:Reference' title='5.4.5&emsp;Concepts&emsp;[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='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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L1957'>#</a></div><div class='texpara'><div id='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='#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'>&lt;</span><span class='keyword'>typename</span> Self, <span class='keyword'>typename</span> FwdQ, <a href='qty.syn.html#concept:Quantity' title='5.6.3&emsp;Class template quantity&emsp;[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'>&lt;</span>FwdQ<span class='anglebracket'>&gt;</span><span class='anglebracket'>&gt;</span>
<span class='keyword'>requires</span> <a class='index' id='conceptref:QuantitySpecExplicitlyConvertibleTo__'></a><span class='texttt'><i >QuantitySpecExplicitlyConvertibleTo</i></span><span class='anglebracket'>&lt;</span>Q<span class='operator'>::</span>quantity_spec, Self<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>&gt;</span>
<span class='keyword'>constexpr</span> <a href='qty.syn.html#concept:Quantity' title='5.6.3&emsp;Class template quantity&emsp;[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'>&amp;</span><span class='operator'>&amp;</span> q<span class='parenthesis'>)</span>;
</code></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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L1970'>#</a></div><div class='texpara'><div id='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'>&lt;</span>FwdQ<span class='anglebracket'>&gt;</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'>&lt;</span><a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec__________________________________'><span class='texttt'>QuantitySpec</span></span></a> Lhs, <a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec___________________________________'><span class='texttt'>QuantitySpec</span></span></a> Rhs<span class='anglebracket'>&gt;</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='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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L1984'>#</a></div><div class='texpara'><div id='ops-5.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>std<span class='operator'>&#x200b;::&#x200b;</span>is_<span class='shy'></span>same_<span class='shy'></span>v<span class='anglebracket'>&lt;</span>Lhs, Rhs<span class='anglebracket'>&gt;</span></span><a class='hidden_link' href='#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&emsp;Concepts&emsp;[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&emsp;Concepts&emsp;[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='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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L1995'>#</a></div><div class='texpara'><div id='ops-6.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>dimensionless <span class='operator'>/</span> q</span><a class='hidden_link' href='#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'>&lt;</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&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec______________________________________'><span class='texttt'>QuantitySpec</span></span></a> Q<span class='anglebracket'>&gt;</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&emsp;Concepts&emsp;[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='ops-7'><div class='marginalizedparent'><a class='marginalized' href='#ops-7'>7</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L2008'>#</a></div><div class='texpara'><div id='ops-7.sentence-1' class='sentence'><i >Returns</i>: <span class='codeblock'><i >clone-kind-of</i><span class='anglebracket'>&lt;</span>Q<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>&gt;</span><span class='parenthesis'>(</span>
<i >expr-pow</i><span class='anglebracket'>&lt;</span>Num, Den, derived_quantity_spec, <span class='keyword'>struct</span> dimensionless<span class='anglebracket'>&gt;</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&emsp;Concepts&emsp;[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&emsp;Concepts&emsp;[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='ops-8'><div class='marginalizedparent'><a class='marginalized' href='#ops-8'>8</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L2022'>#</a></div><div class='texpara'><div id='ops-8.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>pow<span class='anglebracket'>&lt;</span><span class='literal'>1</span>, <span class='literal'>2</span><span class='anglebracket'>&gt;</span><span class='parenthesis'>(</span>q<span class='parenthesis'>)</span></span><a class='hidden_link' href='#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&emsp;Concepts&emsp;[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&emsp;Concepts&emsp;[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='ops-9'><div class='marginalizedparent'><a class='marginalized' href='#ops-9'>9</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L2033'>#</a></div><div class='texpara'><div id='ops-9.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'>pow<span class='anglebracket'>&lt;</span><span class='literal'>1</span>, <span class='literal'>3</span><span class='anglebracket'>&gt;</span><span class='parenthesis'>(</span>q<span class='parenthesis'>)</span></span><a class='hidden_link' href='#ops-9.sentence-1'>.</a></div></div></div></div></div><div id='hier.algos' class='section'><h4 ><a class='secnum' href='#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='conv' class='section'><h4 ><a class='secnum' href='#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='conv-1'><div class='marginalizedparent'><a class='marginalized' href='#conv-1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L2048'>#</a></div><div class='texpara'><div id='conv-1.sentence-1' class='sentence'><i >Returns</i>: TBD<a class='hidden_link' href='#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='conv-2'><div class='marginalizedparent'><a class='marginalized' href='#conv-2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L2059'>#</a></div><div class='texpara'><div id='conv-2.sentence-1' class='sentence'><i >Returns</i>: TBD<a class='hidden_link' href='#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='conv-3'><div class='marginalizedparent'><a class='marginalized' href='#conv-3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L2070'>#</a></div><div class='texpara'><div id='conv-3.sentence-1' class='sentence'><i >Returns</i>: TBD<a class='hidden_link' href='#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='conv-4'><div class='marginalizedparent'><a class='marginalized' href='#conv-4'>4</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L2081'>#</a></div><div class='texpara'><div id='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'>&amp;</span><span class='operator'>&amp;</span> implicitly_<span class='shy'></span>convertible<span class='parenthesis'>(</span>qs2, qs1<span class='parenthesis'>)</span></span><a class='hidden_link' href='#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'>&lt;</span><a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec____________________________________________'><span class='texttt'>QuantitySpec</span></span></a> Q<span class='anglebracket'>&gt;</span>
<span class='keyword'>consteval</span> <a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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'>&lt;</span>Q<span class='anglebracket'>&gt;</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'>&lt;</span>Q, quantity_<span class='shy'></span>spec<span class='anglebracket'>&gt;</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'>&#x200b;::&#x200b;</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'>&#x200b;::&#x200b;</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'>&#x200b;::&#x200b;</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'>&lt;</span>Q<span class='anglebracket'>&gt;</span></span> is <span class='texttt'><span class='literal'>true</span></span>,
returns
<span class='codeblock'><i >expr-map</i><span class='anglebracket'>&lt;</span><i >to-kind</i>, derived_quantity_spec, <span class='keyword'>struct</span> dimensionless<span class='anglebracket'>&gt;</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'>&lt;</span><a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec______________________________________________'><span class='tcode_in_codeblock'>QuantitySpec</span></span></a> Q<span class='anglebracket'>&gt;</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'>&lt;</span><a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec_______________________________________________'><span class='texttt'>QuantitySpec</span></span></a> Q<span class='anglebracket'>&gt;</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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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'>&lt;</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'>&gt;</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&emsp;Concepts&emsp;[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&emsp;Concepts&emsp;[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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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'>&lt;</span>Q1, Q2<span class='anglebracket'>&gt;</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'>&lt;</span>Q1<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Q2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>&gt;</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'>&lt;</span>Q2<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Q1<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>&gt;</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'>&lt;</span>Q1<span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span> <span class='operator'>!</span><a class='index' id='conceptref:QuantityKindSpec_________'></a><i >QuantityKindSpec</i><span class='anglebracket'>&lt;</span>Q2<span class='anglebracket'>&gt;</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'>&lt;</span>QQ1<span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span> <a class='index' id='conceptref:NamedQuantitySpec___'></a><i >NamedQuantitySpec</i><span class='anglebracket'>&lt;</span>QQ2<span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</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'>&lt;</span>Q1<span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span> <a class='index' id='conceptref:QuantityKindSpec___________'></a><i >QuantityKindSpec</i><span class='anglebracket'>&lt;</span>Q2<span class='anglebracket'>&gt;</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'>&lt;</span>QQ1<span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span> <a class='index' id='conceptref:DerivedQuantitySpec____'></a><i >DerivedQuantitySpec</i><span class='anglebracket'>&lt;</span>QQ2<span class='anglebracket'>&gt;</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</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'>&lt;</span>Q1<span class='curlybracket'>{</span><span class='curlybracket'>}</span>, Q2<span class='curlybracket'>{</span><span class='curlybracket'>}</span><span class='anglebracket'>&gt;</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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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'>&amp;</span><span class='operator'>&amp;</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'>&amp;</span><span class='operator'>&amp;</span>
<span class='parenthesis'>(</span><a class='index' id='conceptref:QuantitySpecConvertibleTo_'></a><i >QuantitySpecConvertibleTo</i><span class='anglebracket'>&lt;</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'>&gt;</span> <span class='operator'>|</span><span class='operator'>|</span>
<a class='index' id='conceptref:QuantitySpecConvertibleTo__'></a><i >QuantitySpecConvertibleTo</i><span class='anglebracket'>&lt;</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'>&gt;</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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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&emsp;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'>&lt;</span><a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[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&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec___________________________________________________'><span class='texttt'>QuantitySpec</span></span></a> <span class='keyword'>auto</span> B<span class='anglebracket'>&gt;</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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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'>&#x200b;::&#x200b;</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'>&#x200b;::&#x200b;</span>optional<span class='anglebracket'>&lt;</span><i ><span class='texttt'>unspecified</span></i><span class='anglebracket'>&gt;</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'>&lt;</span><a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec____________________________________________________'><span class='texttt'>QuantitySpec</span></span></a> Child, <a href='#concept:QuantitySpec' title='5.4.3.2&emsp;Concepts&emsp;[qty.spec.concepts]'><span id='conceptref:QuantitySpec_____________________________________________________'><span class='texttt'>QuantitySpec</span></span></a> Parent<span class='anglebracket'>&gt;</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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/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></body></html>