<!DOCTYPE html><htmllang='en'><head><title>[qty.scaled.unit]</title><metacharset='UTF-8'/><linkrel='stylesheet'type='text/css'href='14882.css'/><linkrel='stylesheet'type='text/css'href='https://fonts.googleapis.com/css2?family=Noto+Serif'/><linkrel='stylesheet'type='text/css'href='https://fonts.googleapis.com/css2?family=Noto+Sans'/><linkrel='stylesheet'type='text/css'href='https://fonts.googleapis.com/css2?family=Noto+Sans+Mono'/><linkrel='icon'href='icon.png'/><linkrel='stylesheet'type='text/css'href='expanded.css'title='Normal'/><linkrel='alternate stylesheet'type='text/css'href='colored.css'title='Notes and examples colored'/><linkrel='alternate stylesheet'type='text/css'href='normative-only.css'title='Notes and examples hidden'/></head><body><divclass='wrapper'><h1><aclass='secnum'style='min-width:50pt'>5</a> Quantities and units library <aclass='abbr_ref'href='index.html#quantities'>[quantities]</a></h1><h2><aclass='secnum'style='min-width:65pt'>5.4</a> Reference <aclass='abbr_ref'href='qty.ref.html#qty.scaled.unit'>[qty.ref]</a></h2><h3><aclass='secnum'style='min-width:80pt'>5.4.4</a> Unit <aclass='abbr_ref'href='qty.unit.html#qty.scaled.unit'>[qty.unit]</a></h3><h4><aclass='secnum'style='min-width:95pt'>5.4.4.5</a> Types <aclass='abbr_ref'href='qty.unit.types.html#qty.scaled.unit'>[qty.unit.types]</a></h4><h4><aclass='secnum'style='min-width:110pt'>5.4.4.5.2</a> Scaled <aclass='abbr_ref'>[qty.scaled.unit]</a></h4><divclass='texpara'><spanid='lib:scaled_unit'><divclass='marginalizedparent'><aclass='itemDeclLink'href='#lib:scaled_unit'>🔗</a></div><spanclass='codeblock'><spanclass='keyword'>namespace</span> mp_units <spanclass='curlybracket'>{</span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span><ahref='qty.unit.mag.concepts.html#concept:UnitMagnitude'title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><spanid='conceptref:UnitMagnitude'><spanclass='tcode_in_codeblock'>UnitMagnitude</span></span></a><spanclass='keyword'>auto</span> M, <ahref='qty.unit.concepts.html#concept:Unit'title='5.4.4.4 Concepts [qty.unit.concepts]'><spanid='conceptref:Unit'><spanclass='tcode_in_codeblock'>Unit</span></span></a> U<spanclass='anglebracket'>></span>
<spanclass='keyword'>requires</span><spanclass='parenthesis'>(</span>M <spanclass='operator'>!</span><spanclass='operator'>=</span><i>unit-magnitude</i><spanclass='anglebracket'><</span><spanclass='anglebracket'>></span><spanclass='curlybracket'>{</span><spanclass='curlybracket'>}</span><spanclass='operator'>&</span><spanclass='operator'>&</span> M <spanclass='operator'>!</span><spanclass='operator'>=</span> mag<spanclass='anglebracket'><</span><spanclass='literal'>1</span><spanclass='anglebracket'>></span><spanclass='parenthesis'>)</span>
<spanclass='keyword'>static</span><spanclass='keyword'>constexpr</span><ahref='qty.unit.mag.concepts.html#concept:UnitMagnitude'title='5.4.4.2.2 Concepts [qty.unit.mag.concepts]'><spanid='conceptref:UnitMagnitude_'><spanclass='tcode_in_codeblock'>UnitMagnitude</span></span></a><spanclass='keyword'>auto</span><i>mag</i><spanclass='operator'>=</span> M; <spanclass='comment'>// <i>exposition only</i></span>
<spanclass='keyword'>static</span><spanclass='keyword'>constexpr</span> U <i>reference-unit</i><spanclass='curlybracket'>{</span><spanclass='curlybracket'>}</span>; <spanclass='comment'>// <i>exposition only</i></span>
<spanclass='comment'>// if the <spanclass='textsf'><i>qualified-id</i></span><spanclass='tcode_in_codeblock'>U​::​point_<spanclass='shy'></span>origin</span> is valid and denotes an object</span>
</span></span></div><divclass='para'id='1'><divclass='marginalizedparent'><aclass='marginalized'href='#1'>1</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L2635'>#</a></div><divclass='texpara'><divid='1.sentence-1'class='sentence'><spanclass='texttt'>scaled_<spanclass='shy'></span>unit<spanclass='anglebracket'><</span>M, U<spanclass='anglebracket'>></span></span> is used by the library
to represent the unit <spanclass='math'><spanclass='texttt'>M</span>×<spanclass='texttt'>U</span></span><aclass='hidden_link'href='#1.sentence-1'>.</a></div></div></div></div></body></html>