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

15 lines
5.1 KiB
HTML

<!DOCTYPE html><html lang='en'><head><title>[qty.scaled.unit]</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.scaled.unit'>[qty.ref]</a></h2><h3 ><a class='secnum' style='min-width:80pt'>5.4.4</a> Unit <a class='abbr_ref' href='qty.unit.html#qty.scaled.unit'>[qty.unit]</a></h3><h4 ><a class='secnum' style='min-width:95pt'>5.4.4.5</a> Types <a class='abbr_ref' href='qty.unit.types.html#qty.scaled.unit'>[qty.unit.types]</a></h4><h4 ><a class='secnum' style='min-width:110pt'>5.4.4.5.2</a> Scaled <a class='abbr_ref'>[qty.scaled.unit]</a></h4><div class='texpara'><span id='lib:scaled_unit'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:scaled_unit'>🔗</a></div><span class='codeblock'><span class='keyword'>namespace</span> mp_units <span class='curlybracket'>{</span>
<span class='keyword'>template</span><span class='anglebracket'>&lt;</span><a href='qty.unit.mag.concepts.html#concept:UnitMagnitude' title='5.4.4.2.2&emsp;Concepts&emsp;[qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude'><span class='tcode_in_codeblock'>UnitMagnitude</span></span></a> <span class='keyword'>auto</span> M, <a href='qty.unit.concepts.html#concept:Unit' title='5.4.4.4&emsp;Concepts&emsp;[qty.unit.concepts]'><span id='conceptref:Unit'><span class='tcode_in_codeblock'>Unit</span></span></a> U<span class='anglebracket'>&gt;</span>
<span class='keyword'>requires</span><span class='parenthesis'>(</span>M <span class='operator'>!</span><span class='operator'>=</span> <i >unit-magnitude</i><span class='anglebracket'>&lt;</span><span class='anglebracket'>&gt;</span><span class='curlybracket'>{</span><span class='curlybracket'>}</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span> M <span class='operator'>!</span><span class='operator'>=</span> mag<span class='anglebracket'>&lt;</span><span class='literal'>1</span><span class='anglebracket'>&gt;</span><span class='parenthesis'>)</span>
<span class='keyword'>struct</span> scaled_unit <span class='keyword'>final</span> <span class='operator'>:</span> <i >unit-interface</i> <span class='curlybracket'>{</span>
<span class='keyword'>using</span> <i >base-type</i> <span class='operator'>=</span> scaled_unit; <span class='comment'>// <i >exposition only</i></span>
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <a href='qty.unit.mag.concepts.html#concept:UnitMagnitude' title='5.4.4.2.2&emsp;Concepts&emsp;[qty.unit.mag.concepts]'><span id='conceptref:UnitMagnitude_'><span class='tcode_in_codeblock'>UnitMagnitude</span></span></a> <span class='keyword'>auto</span> <i >mag</i> <span class='operator'>=</span> M; <span class='comment'>// <i >exposition only</i></span>
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> U <i >reference-unit</i><span class='curlybracket'>{</span><span class='curlybracket'>}</span>; <span class='comment'>// <i >exposition only</i></span>
<span class='keyword'>static</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <i >point-origin</i> <span class='operator'>=</span> U<span class='operator'>::</span>point_origin; <span class='comment'>// <i >exposition only</i>, present only</span>
<span class='comment'>// if the <span class='textsf'><i >qualified-id</i></span> <span class='tcode_in_codeblock'>U&#x200b;::&#x200b;point_<span class='shy'></span>origin</span> is valid and denotes an object</span>
<span class='curlybracket'>}</span>;
<span class='curlybracket'>}</span>
</span></span></div><div class='para' id='1'><div class='marginalizedparent'><a class='marginalized' href='#1'>1</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L2635'>#</a></div><div class='texpara'><div id='1.sentence-1' class='sentence'><span class='texttt'>scaled_<span class='shy'></span>unit<span class='anglebracket'>&lt;</span>M, U<span class='anglebracket'>&gt;</span></span> is used by the library
to represent the unit <span class='math'><span class='texttt'>M</span> &times;<span class='texttt'>U</span></span><a class='hidden_link' href='#1.sentence-1'>.</a></div></div></div></div></body></html>