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

18 lines
8.6 KiB
HTML

<!DOCTYPE html><html lang='en'><head><title>[qty.get.kind]</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.get.kind'>[qty.ref]</a></h2><h3 ><a class='secnum' style='min-width:80pt'>5.4.3</a> Quantity specification <a class='abbr_ref' href='qty.spec.html#qty.get.kind'>[qty.spec]</a></h3><h4 ><a class='secnum' style='min-width:95pt'>5.4.3.6</a> Hierarchy algorithms <a class='abbr_ref' href='qty.spec.hier.algos.html#qty.get.kind'>[qty.spec.hier.algos]</a></h4><h4 ><a class='secnum' style='min-width:110pt'>5.4.3.6.2</a> Get kind <a class='abbr_ref'>[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='qty.spec.concepts.html#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='qty.spec.concepts.html#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='1'><div class='marginalizedparent'><a class='marginalized' href='#1'>1</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units94d7b2bb104446bf4399cd3942b7c74dff32c269/source/quantities.tex#L2095'>#</a></div><div class='texpara'><div id='1.sentence-1' class='sentence'><i >Returns</i>: <ul class='itemize'><li id='1.1'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#1.1'>(1.1)</a></div><div class='texpara'><div id='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='#1.1.sentence-1'>.</a></div></div></li><li id='1.2'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#1.2'>(1.2)</a></div><div class='texpara'><div id='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='#1.2.sentence-1'>.</a></div></div></li><li id='1.3'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#1.3'>(1.3)</a></div><div class='texpara'><div id='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='#1.3.sentence-1'>.</a></div></div></li><li id='1.4'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#1.4'>(1.4)</a></div><div class='texpara'><div id='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='qty.spec.concepts.html#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='1.5'><div class='marginalizedparent' style='left:-39mm'><a class='marginalized' href='#1.5'>(1.5)</a></div><div class='texpara'><div id='1.5.sentence-1' class='sentence'>Otherwise, returns <span class='texttt'>q</span><a class='hidden_link' href='#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='qty.spec.concepts.html#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='2'><div class='marginalizedparent'><a class='marginalized' href='#2'>2</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-units94d7b2bb104446bf4399cd3942b7c74dff32c269/source/quantities.tex#L2133'>#</a></div><div class='texpara'><div id='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='#2.sentence-1'>.</a></div></div></div></div></div></body></html>