<!DOCTYPE html><htmllang='en'><head><title>[qty]</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.6</a> Quantity <aclass='abbr_ref'>[qty]</a></h2><divid='general'class='section'><h3><aclass='secnum'href='#general'style='min-width:80pt'>5.6.1</a> General <aclass='abbr_ref'href='qty.general.html'>[qty.general]</a></h3><divclass='para'id='general-1'><divclass='marginalizedparent'><aclass='marginalized'href='#general-1'>1</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4063'>#</a></div><divclass='texpara'><divid='general-1.sentence-1'class='sentence'>Subclause [qty] describes the class template <spanclass='texttt'>quantity</span>
that is an element of a vector space (<ahref="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=102-03-01,102-03-04">IEC 60050, 102-03-01,102-03-04</a>)<aclass='hidden_link'href='#general-1.sentence-1'>.</a></div></div></div></div><divid='like'class='section'><h3><aclass='secnum'href='#like'style='min-width:80pt'>5.6.2</a> Interoperability <aclass='abbr_ref'href='qty.like.html'>[qty.like]</a></h3><divclass='para'id='like-1'><divclass='marginalizedparent'><aclass='marginalized'href='#like-1'>1</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4070'>#</a></div><divclass='texpara'><divid='like-1.sentence-1'class='sentence'>The interfaces specified in this subclause and subclause <ahref='qty.pt.like.html'title='5.7.3 Interoperability'>[qty.<spanclass='shy'></span>pt.<spanclass='shy'></span>like]</a>
are used by <spanclass='texttt'>quantity</span> and <spanclass='texttt'>quantity_<spanclass='shy'></span>point</span>
to specify conversions with other types representing quantities<aclass='hidden_link'href='#like-1.sentence-1'>.</a></div><divid='like-note-1'class='note'><divclass='texpara'>[<i>Note <ahref='#like-note-1'>1</a></i>: <divid='like-1.sentence-2'class='sentence'><ahref='qty.chrono.html'title='5.9 std​::​chrono interoperability'>[qty.<spanclass='shy'></span>chrono]</a> implements them for <spanclass='texttt'>std<spanclass='operator'>​::​</span>chrono<spanclass='operator'>​::​</span>duration</span> and <spanclass='texttt'>std<spanclass='operator'>​::​</span>chrono<spanclass='operator'>​::​</span>time_<spanclass='shy'></span>point</span><aclass='hidden_link'href='#like-1.sentence-2'>.</a></div> — <i>end note</i>]</div></div></div></div><divclass='texpara'><divclass='itemdecl'id='like-itemdecl:1'><divclass='marginalizedparent'><aclass='itemDeclLink'href='#like-itemdecl:1'>🔗</a></div><codeclass='itemdeclcode'><spanclass='keyword'>template</span><spanclass='anglebracket'><</span><spanclass='keyword'>typename</span> T, <spanclass='keyword'>template</span><spanclass='anglebracket'><</span><spanclass='keyword'>typename</span><spanclass='anglebracket'>></span><spanclass='keyword'>typename</span> Traits<spanclass='anglebracket'>></span>
</code></div></div><divclass='para'id='like-2'><divclass='marginalizedparent'><aclass='marginalized'href='#like-2'>2</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4095'>#</a></div><divclass='texpara'><divid='like-2.sentence-1'class='sentence'>In the following descriptions, let
<ulclass='itemize'><liid='like-2.1'><divclass='marginalizedparent'style='left:-27mm'><aclass='marginalized'href='#like-2.1'>(2.1)</a></div><spanclass='texttt'>Traits</span> be <spanclass='texttt'>quantity_<spanclass='shy'></span>like_<spanclass='shy'></span>traits</span> or <spanclass='texttt'>quantity_<spanclass='shy'></span>point_<spanclass='shy'></span>like_<spanclass='shy'></span>traits</span>,</li><liid='like-2.2'><divclass='marginalizedparent'style='left:-27mm'><aclass='marginalized'href='#like-2.2'>(2.2)</a></div><spanclass='texttt'>Q</span> be a type for which <spanclass='texttt'>Traits<spanclass='anglebracket'><</span>Q<spanclass='anglebracket'>></span></span> is specialized,</li><liid='like-2.3'><divclass='marginalizedparent'style='left:-27mm'><aclass='marginalized'href='#like-2.3'>(2.3)</a></div><spanclass='texttt'>qty</span> be an lvalue of type <spanclass='texttt'><spanclass='keyword'>const</span> Q</span>, and</li><liid='like-2.4'><divclass='marginalizedparent'style='left:-27mm'><aclass='marginalized'href='#like-2.4'>(2.4)</a></div><spanclass='texttt'>num</span> be an lvalue of type <spanclass='texttt'><spanclass='keyword'>const</span> Traits<spanclass='anglebracket'><</span>Q<spanclass='anglebracket'>></span><spanclass='operator'>​::​</span>rep</span><aclass='hidden_link'href='#like-2.sentence-1'>.</a></li></ul></div></div></div><divclass='para'id='like-3'><divclass='marginalizedparent'><aclass='marginalized'href='#like-3'>3</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4108'>#</a></div><divclass='texpara'><divid='like-3.sentence-1'class='sentence'><spanclass='texttt'>Q</span> models <spanclass='texttt'><aclass='index'id='conceptref:qty-like-impl_'></a><spanclass='texttt'><i>qty-like-impl</i></span><spanclass='anglebracket'><</span>Traits<spanclass='anglebracket'>></span></span> if and only if:
<ulclass='itemize'><liid='like-3.1'><divclass='marginalizedparent'style='left:-27mm'><aclass='marginalized'href='#like-3.1'>(3.1)</a></div><divclass='texpara'><divid='like-3.1.sentence-1'class='sentence'><spanclass='texttt'>Traits<spanclass='anglebracket'><</span>Q<spanclass='anglebracket'>></span><spanclass='operator'>​::​</span>to_<spanclass='shy'></span>numerical_<spanclass='shy'></span>value<spanclass='parenthesis'>(</span>qty<spanclass='parenthesis'>)</span></span> returns the numerical value (<ahref="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-29">IEC 60050, 112-01-29</a>) of <spanclass='texttt'>qty</span><aclass='hidden_link'href='#like-3.1.sentence-1'>.</a></div></div></li><liid='like-3.2'><divclass='marginalizedparent'style='left:-27mm'><aclass='marginalized'href='#like-3.2'>(3.2)</a></div><divclass='texpara'><divid='like-3.2.sentence-1'class='sentence'><spanclass='texttt'>Traits<spanclass='anglebracket'><</span>Q<spanclass='anglebracket'>></span><spanclass='operator'>​::​</span>from_<spanclass='shy'></span>numerical_<spanclass='shy'></span>value<spanclass='parenthesis'>(</span>num<spanclass='parenthesis'>)</span></span> returns a <spanclass='texttt'>Q</span> with numerical value <spanclass='texttt'>num</span><aclass='hidden_link'href='#like-3.2.sentence-1'>.</a></div></div></li><liid='like-3.3'><divclass='marginalizedparent'style='left:-27mm'><aclass='marginalized'href='#like-3.3'>(3.3)</a></div><divclass='texpara'><divid='like-3.3.sentence-1'class='sentence'>If <spanclass='texttt'>Traits</span> is <spanclass='texttt'>quantity_<spanclass='shy'></span>point_<spanclass='shy'></span>like_<spanclass='shy'></span>traits</span>,
both numerical values are offset from <spanclass='texttt'>Traits<spanclass='anglebracket'><</span>Q<spanclass='anglebracket'>></span><spanclass='operator'>​::​</span>point_<spanclass='shy'></span>origin</span><aclass='hidden_link'href='#like-3.3.sentence-1'>.</a></div></div></li></ul></div></div></div><divclass='para'id='like-4'><divclass='marginalizedparent'><aclass='marginalized'href='#like-4'>4</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4120'>#</a></div><divclass='texpara'><divid='like-4.sentence-1'class='sentence'>If the following expression is <spanclass='texttt'><spanclass='literal'>true</span></span>, the specified conversion will be explicit<aclass='hidden_link'href='#like-4.sentence-1'>.</a></div><ulclass='itemize'><liid='like-4.1'><divclass='marginalizedparent'style='left:-27mm'><aclass='marginalized'href='#like-4.1'>(4.1)</a></div><divclass='texpara'><divid='like-4.1.sentence-1'class='sentence'><spanclass='texttt'>Traits<spanclass='anglebracket'><</span>Q<spanclass='anglebracket'>></span><spanclass='operator'>​::​</span>explicit_<spanclass='shy'></span>import</span> for the conversion from <spanclass='texttt'>Q</span> to this library's type<aclass='hidden_link'href='#like-4.1.sentence-1'>.</a></div></div></li><liid='like-4.2'><divclass='marginalizedparent'style='left:-27mm'><aclass='marginalized'href='#like-4.2'>(4.2)</a></div><divclass='texpara'><divid='like-4.2.sentence-1'class='sentence'><spanclass='texttt'>Traits<spanclass='anglebracket'><</span>Q<spanclass='anglebracket'>></span><spanclass='operator'>​::​</span>explicit_<spanclass='shy'></span>export</span> for the conversion from this library's type to <spanclass='texttt'>Q</span><aclass='hidden_link'href='#like-4.2.sentence-1'>.</a></div></div></li></ul></div></div></div><divid='syn'class='section'><h3><aclass='secnum'href='#syn'style='min-width:80pt'>5.6.3</a> Class template <spanclass='texttt'>quantity</span><aclass='abbr_ref'href='qty.syn.html'>[qty.syn]</a></h3><divclass='texpara'><spanclass='codeblock'><spanclass='keyword'>namespace</span> mp_units <spanclass='curlybracket'>{</span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span><spanclass='keyword'>typename</span> Q, <spanclass='keyword'>auto</span> QS<spanclass='anglebracket'>></span>
<spanclass='keyword'>static</span><spanclass='keyword'>constexpr</span><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><spanclass='keyword'>auto</span> unit <spanclass='operator'>=</span> get_unit<spanclass='parenthesis'>(</span>reference<spanclass='parenthesis'>)</span>;
<spanclass='comment'>// <ahref='#static'title='5.6.4 Static member functions'>[qty.<spanclass='shy'></span>static]</a>, static member functions</span>
<spanclass='comment'>// <ahref='#cons'title='5.6.5 Constructors and assignment'>[qty.<spanclass='shy'></span>cons]</a>, constructors and assignment</span>
<spanclass='comment'>// <ahref='#obs'title='5.6.7 Numerical value observers'>[qty.<spanclass='shy'></span>obs]</a>, numerical value observers</span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span><aclass='index'id='conceptref:Mutable_____'></a><i>Mutable</i><spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <aclass='index'id='conceptref:ValuePreservingTo__'></a><i>ValuePreservingTo</i><spanclass='anglebracket'><</span>Rep<spanclass='anglebracket'>></span> Value<spanclass='anglebracket'>></span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span><aclass='index'id='conceptref:Mutable______'></a><i>Mutable</i><spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <aclass='index'id='conceptref:ValuePreservingTo___'></a><i>ValuePreservingTo</i><spanclass='anglebracket'><</span>Rep<spanclass='anglebracket'>></span> Value<spanclass='anglebracket'>></span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <ahref='qty.rep.concepts.html#concept:Representation'title='5.5.4 Concepts [qty.rep.concepts]'><spanid='conceptref:Representation__'><spanclass='tcode_in_codeblock'>Representation</span></span></a> Value<spanclass='anglebracket'>></span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <ahref='qty.rep.concepts.html#concept:Representation'title='5.5.4 Concepts [qty.rep.concepts]'><spanid='conceptref:Representation___'><spanclass='tcode_in_codeblock'>Representation</span></span></a> Value<spanclass='anglebracket'>></span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <ahref='qty.rep.concepts.html#concept:Representation'title='5.5.4 Concepts [qty.rep.concepts]'><spanid='conceptref:Representation____'><spanclass='tcode_in_codeblock'>Representation</span></span></a> Value<spanclass='anglebracket'>></span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <ahref='qty.rep.concepts.html#concept:Representation'title='5.5.4 Concepts [qty.rep.concepts]'><spanid='conceptref:Representation_____'><spanclass='tcode_in_codeblock'>Representation</span></span></a> Value<spanclass='anglebracket'>></span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <ahref='qty.rep.concepts.html#concept:Representation'title='5.5.4 Concepts [qty.rep.concepts]'><spanid='conceptref:Representation______'><spanclass='tcode_in_codeblock'>Representation</span></span></a> Value<spanclass='anglebracket'>></span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <ahref='qty.rep.concepts.html#concept:Representation'title='5.5.4 Concepts [qty.rep.concepts]'><spanid='conceptref:Representation_______'><spanclass='tcode_in_codeblock'>Representation</span></span></a> Value<spanclass='anglebracket'>></span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <spanclass='keyword'>typename</span> Value<spanclass='anglebracket'>></span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <spanclass='keyword'>typename</span> Value<spanclass='anglebracket'>></span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <ahref='qty.rep.concepts.html#concept:Representation'title='5.5.4 Concepts [qty.rep.concepts]'><spanid='conceptref:Representation________'><spanclass='tcode_in_codeblock'>Representation</span></span></a> Value<spanclass='anglebracket'>></span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <ahref='qty.rep.concepts.html#concept:Representation'title='5.5.4 Concepts [qty.rep.concepts]'><spanid='conceptref:Representation_________'><spanclass='tcode_in_codeblock'>Representation</span></span></a> Value<spanclass='anglebracket'>></span>
<spanclass='comment'>// <ahref='#val.cmp'title='5.6.13 Value comparison'>[qty.<spanclass='shy'></span>val.<spanclass='shy'></span>cmp]</a>, value comparison</span>
</span></div><divclass='para'id='syn-1'><divclass='marginalizedparent'><aclass='marginalized'href='#syn-1'>1</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4466'>#</a></div><divclass='texpara'><divid='syn-1.sentence-1'class='sentence'><spanclass='texttt'>quantity<spanclass='anglebracket'><</span>R, Rep<spanclass='anglebracket'>></span></span> is a structural type (<ahref="https://wg21.link/temp.paramterm.structural.type">N4971, [temp.param]</a>)
if <spanclass='texttt'>Rep</span> is a structural type<aclass='hidden_link'href='#syn-1.sentence-1'>.</a></div></div></div></div><divid='static'class='section'><h3><aclass='secnum'href='#static'style='min-width:80pt'>5.6.4</a> Static member functions <aclass='abbr_ref'href='qty.static.html'>[qty.static]</a></h3><divclass='texpara'><divid='lib:quantity,max'><divid='lib:max,quantity'><divid='lib:quantity,min'><divid='lib:min,quantity'><divid='lib:quantity,one'><divid='lib:one,quantity'><divid='lib:quantity,zero'><divid='lib:zero,quantity'><divclass='itemdecl'><divclass='marginalizedparent'><aclass='itemDeclLink'href='#lib:zero,quantity'>🔗</a></div><codeclass='itemdeclcode'><spanclass='keyword'>static</span><spanclass='keyword'>constexpr</span> quantity zero<spanclass='parenthesis'>(</span><spanclass='parenthesis'>)</span><spanclass='keyword'>noexcept</span>
</code></div></div></div></div></div></div></div></div></div></div><divclass='para'id='static-1'><divclass='marginalizedparent'><aclass='marginalized'href='#static-1'>1</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4488'>#</a></div><divclass='texpara'><divid='static-1.sentence-1'class='sentence'>Let <i>F</i> be one of <spanclass='texttt'>zero</span>, <spanclass='texttt'>one</span>, <spanclass='texttt'>min</span>, and <spanclass='texttt'>max</span><aclass='hidden_link'href='#static-1.sentence-1'>.</a></div></div></div></div><divclass='para'id='static-2'><divclass='marginalizedparent'><aclass='marginalized'href='#static-2'>2</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4491'>#</a></div><divclass='texpara'><divid='static-2.sentence-1'class='sentence'><i>Returns</i>: <spanclass='texttt'><spanclass='curlybracket'>{</span>representation_<spanclass='shy'></span>values<spanclass='anglebracket'><</span>rep<spanclass='anglebracket'>></span><spanclass='operator'>​::​</span><i>F</i><spanclass='parenthesis'>(</span><spanclass='parenthesis'>)</span>, R<spanclass='curlybracket'>}</span></span><aclass='hidden_link'href='#static-2.sentence-1'>.</a></div></div></div></div><divclass='para'id='static-3'><divclass='marginalizedparent'><aclass='marginalized'href='#static-3'>3</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4495'>#</a></div><divclass='texpara'><divid='static-3.sentence-1'class='sentence'><i>Remarks</i>: The expression in the <spanclass='textsf'><i>requires-clause</i></span> is equivalent to:
</code></div></div></div><divclass='para'id='cons-2'><divclass='marginalizedparent'><aclass='marginalized'href='#cons-2'>2</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4531'>#</a></div><divclass='texpara'><divid='cons-2.sentence-1'class='sentence'><i>Effects</i>: Equivalent to
</code></div></div></div><divclass='para'id='cons-4'><divclass='marginalizedparent'><aclass='marginalized'href='#cons-4'>4</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4557'>#</a></div><divclass='texpara'><divid='cons-4.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</span></div></div></div></div><divclass='para'id='cons-5'><divclass='marginalizedparent'><aclass='marginalized'href='#cons-5'>5</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4565'>#</a></div><divclass='texpara'><divid='cons-5.sentence-1'class='sentence'><i>Remarks</i>: The expression inside <spanclass='texttt'><spanclass='keyword'>explicit</span></span> is equivalent to:
</code></div></div></div></div><divclass='para'id='conv-1'><divclass='marginalizedparent'><aclass='marginalized'href='#conv-1'>1</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4601'>#</a></div><divclass='texpara'><divid='conv-1.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</code></div></div></div></div><divclass='para'id='conv-2'><divclass='marginalizedparent'><aclass='marginalized'href='#conv-2'>2</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4615'>#</a></div><divclass='texpara'><divid='conv-2.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</code></div></div></div></div><divclass='para'id='conv-3'><divclass='marginalizedparent'><aclass='marginalized'href='#conv-3'>3</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4631'>#</a></div><divclass='texpara'><divid='conv-3.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</code></div></div></div></div><divclass='para'id='conv-4'><divclass='marginalizedparent'><aclass='marginalized'href='#conv-4'>4</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4647'>#</a></div><divclass='texpara'><divid='conv-4.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</code></div></div></div></div><divclass='para'id='conv-5'><divclass='marginalizedparent'><aclass='marginalized'href='#conv-5'>5</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4661'>#</a></div><divclass='texpara'><divid='conv-5.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</code></div></div></div></div><divclass='para'id='conv-6'><divclass='marginalizedparent'><aclass='marginalized'href='#conv-6'>6</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4676'>#</a></div><divclass='texpara'><divid='conv-6.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</code></div></div></div></div><divclass='para'id='obs-2'><divclass='marginalizedparent'><aclass='marginalized'href='#obs-2'>2</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4708'>#</a></div><divclass='texpara'><divid='obs-2.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</code></div></div></div></div><divclass='para'id='obs-3'><divclass='marginalizedparent'><aclass='marginalized'href='#obs-3'>3</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4722'>#</a></div><divclass='texpara'><divid='obs-3.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</code></div></div></div><divclass='para'id='conv.ops-2'><divclass='marginalizedparent'><aclass='marginalized'href='#conv.ops-2'>2</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4751'>#</a></div><divclass='texpara'><divid='conv.ops-2.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</span></div></div></div></div><divclass='para'id='conv.ops-3'><divclass='marginalizedparent'><aclass='marginalized'href='#conv.ops-3'>3</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4759'>#</a></div><divclass='texpara'><divid='conv.ops-3.sentence-1'class='sentence'><i>Remarks</i>: The expression inside <spanclass='texttt'><spanclass='keyword'>explicit</span></span> is equivalent to:
</span></div></div></div></div></div><divid='unary.ops'class='section'><h3><aclass='secnum'href='#unary.ops'style='min-width:80pt'>5.6.9</a> Unary operations <aclass='abbr_ref'href='qty.unary.ops.html'>[qty.unary.ops]</a></h3><divclass='para'id='unary.ops-1'><divclass='marginalizedparent'><aclass='marginalized'href='#unary.ops-1'>1</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4775'>#</a></div><divclass='texpara'><divid='unary.ops-1.sentence-1'class='sentence'>In the following descriptions,
let <spanclass='texttt'>@</span> be the <spanclass='textsf'><i>operator</i></span><aclass='hidden_link'href='#unary.ops-1.sentence-1'>.</a></div></div></div><divclass='texpara'><divid='lib:quantity,operator-'><divid='lib:operator-,quantity'><divid='lib:quantity,operator+'><divid='lib:operator+,quantity'><divclass='itemdecl'><divclass='marginalizedparent'><aclass='itemDeclLink'href='#lib:operator+,quantity'>🔗</a></div><codeclass='itemdeclcode'><spanclass='keyword'>constexpr</span><ahref='#concept:QuantityOf'title='5.6.3 Class template quantity [qty.syn]'><spanid='conceptref:QuantityOf_____________________'><spanclass='texttt'>QuantityOf</span></span></a><spanclass='anglebracket'><</span>quantity_spec<spanclass='anglebracket'>></span><spanclass='keyword'>auto</span><spanclass='keyword'>operator</span><spanclass='operator'>+</span><spanclass='parenthesis'>(</span><spanclass='parenthesis'>)</span><spanclass='keyword'>const</span>
</code></div></div></div></div></div></div><divclass='para'id='unary.ops-2'><divclass='marginalizedparent'><aclass='marginalized'href='#unary.ops-2'>2</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4789'>#</a></div><divclass='texpara'><divid='unary.ops-2.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
<spanclass='texttt'><spanclass='keyword'>return</span><spanclass='operator'>​::​</span>mp_<spanclass='shy'></span>units<spanclass='operator'>​::​</span>quantity<spanclass='curlybracket'>{</span>@<spanclass='texttt'><i>numerical-value</i></span>, reference<spanclass='curlybracket'>}</span>;</span></div></div></div></div><divclass='para'id='unary.ops-3'><divclass='marginalizedparent'><aclass='marginalized'href='#unary.ops-3'>3</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4794'>#</a></div><divclass='texpara'><divid='unary.ops-3.sentence-1'class='sentence'><i>Remarks</i>: The expression in the <spanclass='textsf'><i>requires-clause</i></span> is equivalent to:
</code></div></div></div></div></div></div><divclass='para'id='unary.ops-4'><divclass='marginalizedparent'><aclass='marginalized'href='#unary.ops-4'>4</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4816'>#</a></div><divclass='texpara'><divid='unary.ops-4.sentence-1'class='sentence'><i>Effects</i>: Equivalent to
<spanclass='texttt'>@q<spanclass='operator'>.</span><spanclass='texttt'><i>numerical-value</i></span></span><aclass='hidden_link'href='#unary.ops-4.sentence-1'>.</a></div></div></div></div><divclass='para'id='unary.ops-5'><divclass='marginalizedparent'><aclass='marginalized'href='#unary.ops-5'>5</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4821'>#</a></div><divclass='texpara'><divid='unary.ops-5.sentence-1'class='sentence'><i>Returns</i>: <spanclass='texttt'>std<spanclass='operator'>​::​</span>forward<spanclass='anglebracket'><</span>Q<spanclass='anglebracket'>></span><spanclass='parenthesis'>(</span>q<spanclass='parenthesis'>)</span></span><aclass='hidden_link'href='#unary.ops-5.sentence-1'>.</a></div></div></div></div><divclass='para'id='unary.ops-6'><divclass='marginalizedparent'><aclass='marginalized'href='#unary.ops-6'>6</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4825'>#</a></div><divclass='texpara'><divid='unary.ops-6.sentence-1'class='sentence'><i>Remarks</i>: The expression in the <spanclass='textsf'><i>requires-clause</i></span> is equivalent to:
</code></div></div></div></div></div></div><divclass='para'id='unary.ops-7'><divclass='marginalizedparent'><aclass='marginalized'href='#unary.ops-7'>7</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4845'>#</a></div><divclass='texpara'><divid='unary.ops-7.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
<spanclass='texttt'><spanclass='keyword'>return</span><spanclass='operator'>​::​</span>mp_<spanclass='shy'></span>units<spanclass='operator'>​::​</span>quantity<spanclass='curlybracket'>{</span><spanclass='texttt'><i>numerical-value</i></span>@, reference<spanclass='curlybracket'>}</span>;</span></div></div></div></div><divclass='para'id='unary.ops-8'><divclass='marginalizedparent'><aclass='marginalized'href='#unary.ops-8'>8</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4850'>#</a></div><divclass='texpara'><divid='unary.ops-8.sentence-1'class='sentence'><i>Remarks</i>: The expression in the <spanclass='textsf'><i>requires-clause</i></span> is equivalent to:
</span></div></div></div></div></div><divid='assign.ops'class='section'><h3><aclass='secnum'href='#assign.ops'style='min-width:80pt'>5.6.10</a> Compound assignment operations <aclass='abbr_ref'href='qty.assign.ops.html'>[qty.assign.ops]</a></h3><divclass='para'id='assign.ops-1'><divclass='marginalizedparent'><aclass='marginalized'href='#assign.ops-1'>1</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4862'>#</a></div><divclass='texpara'><divid='assign.ops-1.sentence-1'class='sentence'>In the following descriptions,
let <spanclass='texttt'>@</span> be the <spanclass='textsf'><i>operator</i></span><aclass='hidden_link'href='#assign.ops-1.sentence-1'>.</a></div></div></div><divclass='texpara'><divid='lib:quantity,operator%='><divid='lib:operator%=,quantity'><divid='lib:quantity,operator-='><divid='lib:operator-=,quantity'><divid='lib:quantity,operator+='><divid='lib:operator+=,quantity'><divclass='itemdecl'><divclass='marginalizedparent'><aclass='itemDeclLink'href='#lib:operator+=,quantity'>🔗</a></div><codeclass='itemdeclcode'><spanclass='keyword'>template</span><spanclass='anglebracket'><</span><aclass='index'id='conceptref:Mutable___________'></a><spanclass='texttt'><i>Mutable</i></span><spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <spanclass='keyword'>auto</span> R2, <spanclass='keyword'>typename</span> Rep2<spanclass='anglebracket'>></span>
</code></div></div></div></div></div></div></div></div><divclass='para'id='assign.ops-2'><divclass='marginalizedparent'><aclass='marginalized'href='#assign.ops-2'>2</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4882'>#</a></div><divclass='texpara'><divid='assign.ops-2.sentence-1'class='sentence'><i>Preconditions</i>: If <spanclass='texttt'>@</span> is <spanclass='texttt'><spanclass='operator'>%</span><spanclass='operator'>=</span></span>, then <spanclass='texttt'>is_<spanclass='shy'></span>neq_<spanclass='shy'></span>zero<spanclass='parenthesis'>(</span>rhs<spanclass='parenthesis'>)</span></span> is <spanclass='texttt'><spanclass='literal'>true</span></span><aclass='hidden_link'href='#assign.ops-2.sentence-1'>.</a></div></div></div></div><divclass='para'id='assign.ops-3'><divclass='marginalizedparent'><aclass='marginalized'href='#assign.ops-3'>3</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4886'>#</a></div><divclass='texpara'><divid='assign.ops-3.sentence-1'class='sentence'><i>Effects</i>: Equivalent to
<spanclass='texttt'>lhs<spanclass='operator'>.</span><spanclass='texttt'><i>numerical-value</i></span> @ rhs<spanclass='operator'>.</span>in<spanclass='parenthesis'>(</span>lhs<spanclass='operator'>.</span>unit<spanclass='parenthesis'>)</span><spanclass='operator'>.</span><spanclass='texttt'><i>numerical-value</i></span></span><aclass='hidden_link'href='#assign.ops-3.sentence-1'>.</a></div></div></div></div><divclass='para'id='assign.ops-4'><divclass='marginalizedparent'><aclass='marginalized'href='#assign.ops-4'>4</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4891'>#</a></div><divclass='texpara'><divid='assign.ops-4.sentence-1'class='sentence'><i>Returns</i>: <spanclass='texttt'>std<spanclass='operator'>​::​</span>forward<spanclass='anglebracket'><</span>Q<spanclass='anglebracket'>></span><spanclass='parenthesis'>(</span>lhs<spanclass='parenthesis'>)</span></span><aclass='hidden_link'href='#assign.ops-4.sentence-1'>.</a></div></div></div></div><divclass='para'id='assign.ops-5'><divclass='marginalizedparent'><aclass='marginalized'href='#assign.ops-5'>5</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4895'>#</a></div><divclass='texpara'><divid='assign.ops-5.sentence-1'class='sentence'><i>Remarks</i>: Let <i>C</i> be
<ulclass='itemize'><liid='assign.ops-5.1'><divclass='marginalizedparent'style='left:-39mm'><aclass='marginalized'href='#assign.ops-5.1'>(5.1)</a></div><spanclass='texttt'><spanclass='parenthesis'>(</span><spanclass='operator'>!</span>treat_<spanclass='shy'></span>as_<spanclass='shy'></span>floating_<spanclass='shy'></span>point<spanclass='anglebracket'><</span>rep<spanclass='anglebracket'>></span><spanclass='parenthesis'>)</span></span> if <spanclass='texttt'>@</span> is <spanclass='texttt'><spanclass='operator'>%</span><spanclass='operator'>=</span></span>, and</li><liid='assign.ops-5.2'><divclass='marginalizedparent'style='left:-39mm'><aclass='marginalized'href='#assign.ops-5.2'>(5.2)</a></div><spanclass='texttt'><spanclass='literal'>true</span></span> otherwise<aclass='hidden_link'href='#assign.ops-5.sentence-1'>.</a></li></ul></div><divid='assign.ops-5.sentence-2'class='sentence'>
The expression in the <spanclass='textsf'><i>requires-clause</i></span> is equivalent to:
<spanclass='keyword'>requires</span><spanclass='parenthesis'>(</span>rep<spanclass='operator'>&</span> a, <spanclass='keyword'>const</span> Rep2 b<spanclass='parenthesis'>)</span><spanclass='curlybracket'>{</span>
<spanclass='curlybracket'>{</span> a @ b <spanclass='curlybracket'>}</span><spanclass='operator'>-</span><spanclass='anglebracket'>></span> std<spanclass='operator'>::</span>same_as<spanclass='anglebracket'><</span>rep<spanclass='operator'>&</span><spanclass='anglebracket'>></span>;
</span></div></div></div></div><divclass='para'id='assign.ops-6'><divclass='marginalizedparent'><aclass='marginalized'href='#assign.ops-6'>6</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4912'>#</a></div><divclass='texpara'><divid='assign.ops-6.sentence-1'class='sentence'><i>Recommended practice</i>: If <spanclass='texttt'>equivalent<spanclass='parenthesis'>(</span>unit, get_<spanclass='shy'></span>unit<spanclass='parenthesis'>(</span>rhs<spanclass='operator'>.</span>reference<spanclass='parenthesis'>)</span><spanclass='parenthesis'>)</span></span> is <spanclass='texttt'><spanclass='literal'>true</span></span>,
then the expression <spanclass='texttt'>rhs<spanclass='operator'>.</span>in<spanclass='parenthesis'>(</span>lhs<spanclass='operator'>.</span>unit<spanclass='parenthesis'>)</span></span> is replaced with <spanclass='texttt'>rhs</span><aclass='hidden_link'href='#assign.ops-6.sentence-1'>.</a></div></div></div></div><divclass='texpara'><divid='lib:quantity,operator/='><divid='lib:operator/=,quantity'><divid='lib:quantity,operator*='><divid='lib:operator*=,quantity'><divclass='itemdecl'><divclass='marginalizedparent'><aclass='itemDeclLink'href='#lib:operator*=,quantity'>🔗</a></div><codeclass='itemdeclcode'><spanclass='keyword'>template</span><spanclass='anglebracket'><</span><aclass='index'id='conceptref:Mutable______________'></a><spanclass='texttt'><i>Mutable</i></span><spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <aclass='index'id='conceptref:ValuePreservingTo______'></a><spanclass='texttt'><i>ValuePreservingTo</i></span><spanclass='anglebracket'><</span>Rep<spanclass='anglebracket'>></span> Value<spanclass='anglebracket'>></span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span><aclass='index'id='conceptref:Mutable_______________'></a><spanclass='texttt'><i>Mutable</i></span><spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <aclass='index'id='conceptref:ValuePreservingTo_______'></a><spanclass='texttt'><i>ValuePreservingTo</i></span><spanclass='anglebracket'><</span>Rep<spanclass='anglebracket'>></span> Value<spanclass='anglebracket'>></span>
</code></div></div></div></div></div></div><divclass='para'id='assign.ops-7'><divclass='marginalizedparent'><aclass='marginalized'href='#assign.ops-7'>7</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4930'>#</a></div><divclass='texpara'><divid='assign.ops-7.sentence-1'class='sentence'><i>Preconditions</i>: If <spanclass='texttt'>@</span> is <spanclass='texttt'><spanclass='operator'>/</span><spanclass='operator'>=</span></span>, then <spanclass='texttt'>rhs <spanclass='operator'>!</span><spanclass='operator'>=</span> representation_<spanclass='shy'></span>values<spanclass='anglebracket'><</span>Value<spanclass='anglebracket'>></span><spanclass='operator'>​::​</span>zero<spanclass='parenthesis'>(</span><spanclass='parenthesis'>)</span></span> is <spanclass='texttt'><spanclass='literal'>true</span></span><aclass='hidden_link'href='#assign.ops-7.sentence-1'>.</a></div></div></div></div><divclass='para'id='assign.ops-8'><divclass='marginalizedparent'><aclass='marginalized'href='#assign.ops-8'>8</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4934'>#</a></div><divclass='texpara'><divid='assign.ops-8.sentence-1'class='sentence'><i>Effects</i>: Equivalent to
<spanclass='texttt'>lhs<spanclass='operator'>.</span><spanclass='texttt'><i>numerical-value</i></span> @ rhs</span><aclass='hidden_link'href='#assign.ops-8.sentence-1'>.</a></div></div></div></div><divclass='para'id='assign.ops-9'><divclass='marginalizedparent'><aclass='marginalized'href='#assign.ops-9'>9</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4939'>#</a></div><divclass='texpara'><divid='assign.ops-9.sentence-1'class='sentence'><i>Returns</i>: <spanclass='texttt'>std<spanclass='operator'>​::​</span>forward<spanclass='anglebracket'><</span>Q<spanclass='anglebracket'>></span><spanclass='parenthesis'>(</span>lhs<spanclass='parenthesis'>)</span></span><aclass='hidden_link'href='#assign.ops-9.sentence-1'>.</a></div></div></div></div><divclass='para'id='assign.ops-10'><divclass='marginalizedparent'><aclass='marginalized'href='#assign.ops-10'>10</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4943'>#</a></div><divclass='texpara'><divid='assign.ops-10.sentence-1'class='sentence'><i>Remarks</i>: The expression in the <spanclass='textsf'><i>requires-clause</i></span> is equivalent to:
<spanclass='codeblock'><spanclass='parenthesis'>(</span><spanclass='operator'>!</span><ahref='#concept:Quantity'title='5.6.3 Class template quantity [qty.syn]'><spanid='conceptref:Quantity________________________'><spanclass='tcode_in_codeblock'>Quantity</span></span></a><spanclass='anglebracket'><</span>Value<spanclass='anglebracket'>></span><spanclass='parenthesis'>)</span><spanclass='operator'>&</span><spanclass='operator'>&</span><spanclass='keyword'>requires</span><spanclass='parenthesis'>(</span>rep<spanclass='operator'>&</span> a, <spanclass='keyword'>const</span> Value b<spanclass='parenthesis'>)</span><spanclass='curlybracket'>{</span>
<spanclass='curlybracket'>{</span> a @ b <spanclass='curlybracket'>}</span><spanclass='operator'>-</span><spanclass='anglebracket'>></span> std<spanclass='operator'>::</span>same_as<spanclass='anglebracket'><</span>rep<spanclass='operator'>&</span><spanclass='anglebracket'>></span>;
<spanclass='curlybracket'>}</span>
</span></div></div></div></div><divclass='texpara'><divid='lib:quantity,operator/=_'><divid='lib:operator/=,quantity_'><divid='lib:quantity,operator*=_'><divid='lib:operator*=,quantity_'><divclass='itemdecl'><divclass='marginalizedparent'><aclass='itemDeclLink'href='#lib:operator*=,quantity_'>🔗</a></div><codeclass='itemdeclcode'><spanclass='keyword'>template</span><spanclass='anglebracket'><</span><aclass='index'id='conceptref:Mutable________________'></a><spanclass='texttt'><i>Mutable</i></span><spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <ahref='#concept:QuantityOf'title='5.6.3 Class template quantity [qty.syn]'><spanid='conceptref:QuantityOf_________________________'><spanclass='texttt'>QuantityOf</span></span></a><spanclass='anglebracket'><</span>dimensionless<spanclass='anglebracket'>></span> Q2<spanclass='anglebracket'>></span>
</code></div></div></div></div></div></div><divclass='para'id='assign.ops-11'><divclass='marginalizedparent'><aclass='marginalized'href='#assign.ops-11'>11</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4965'>#</a></div><divclass='texpara'><divid='assign.ops-11.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
<spanclass='texttt'><spanclass='keyword'>return</span> std<spanclass='operator'>​::​</span>forward<spanclass='anglebracket'><</span>Q<spanclass='anglebracket'>></span><spanclass='parenthesis'>(</span>lhs<spanclass='parenthesis'>)</span> @ rhs<spanclass='operator'>.</span><spanclass='texttt'><i>numerical-value</i></span>;</span></div></div></div></div><divclass='para'id='assign.ops-12'><divclass='marginalizedparent'><aclass='marginalized'href='#assign.ops-12'>12</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4970'>#</a></div><divclass='texpara'><divid='assign.ops-12.sentence-1'class='sentence'><i>Remarks</i>: The expression in the <spanclass='textsf'><i>requires-clause</i></span> is equivalent to:
<spanclass='keyword'>requires</span><spanclass='parenthesis'>(</span>rep<spanclass='operator'>&</span> a, <spanclass='keyword'>const</span> Q2<spanclass='operator'>::</span>rep b<spanclass='parenthesis'>)</span><spanclass='curlybracket'>{</span>
<spanclass='curlybracket'>{</span> a @ b <spanclass='curlybracket'>}</span><spanclass='operator'>-</span><spanclass='anglebracket'>></span> std<spanclass='operator'>::</span>same_as<spanclass='anglebracket'><</span>rep<spanclass='operator'>&</span><spanclass='anglebracket'>></span>;
</span></div></div></div></div></div><divid='arith.ops'class='section'><h3><aclass='secnum'href='#arith.ops'style='min-width:80pt'>5.6.11</a> Arithmetic operations <aclass='abbr_ref'href='qty.arith.ops.html'>[qty.arith.ops]</a></h3><divclass='para'id='arith.ops-1'><divclass='marginalizedparent'><aclass='marginalized'href='#arith.ops-1'>1</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L4983'>#</a></div><divclass='texpara'><divid='arith.ops-1.sentence-1'class='sentence'>In the following descriptions,
let <spanclass='texttt'>@</span> be the <spanclass='textsf'><i>operator</i></span><aclass='hidden_link'href='#arith.ops-1.sentence-1'>.</a></div></div></div><divclass='texpara'><divid='lib:quantity,operator%'><divid='lib:operator%,quantity'><divid='lib:quantity,operator-_'><divid='lib:operator-,quantity_'><divid='lib:quantity,operator+_'><divid='lib:operator+,quantity_'><divclass='itemdecl'><divclass='marginalizedparent'><aclass='itemDeclLink'href='#lib:operator+,quantity_'>🔗</a></div><codeclass='itemdeclcode'><spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <spanclass='keyword'>auto</span> R2, <spanclass='keyword'>typename</span> Rep2<spanclass='anglebracket'>></span>
</code></div></div></div></div></div></div></div></div><divclass='para'id='arith.ops-2'><divclass='marginalizedparent'><aclass='marginalized'href='#arith.ops-2'>2</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5004'>#</a></div><divclass='texpara'><divid='arith.ops-2.sentence-1'class='sentence'>Let <i>F</i> be the first argument to <aclass='index'id='conceptref:CommonlyInvocableQuantities______'></a><spanclass='texttt'><i>CommonlyInvocableQuantities</i></span><aclass='hidden_link'href='#arith.ops-2.sentence-1'>.</a></div></div></div></div><divclass='para'id='arith.ops-3'><divclass='marginalizedparent'><aclass='marginalized'href='#arith.ops-3'>3</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5007'>#</a></div><divclass='texpara'><divid='arith.ops-3.sentence-1'class='sentence'><i>Preconditions</i>: If <spanclass='texttt'>@</span> is <spanclass='texttt'><spanclass='operator'>%</span></span>, then <spanclass='texttt'>is_<spanclass='shy'></span>neq_<spanclass='shy'></span>zero<spanclass='parenthesis'>(</span>rhs<spanclass='parenthesis'>)</span></span> is <spanclass='texttt'><spanclass='literal'>true</span></span><aclass='hidden_link'href='#arith.ops-3.sentence-1'>.</a></div></div></div></div><divclass='para'id='arith.ops-4'><divclass='marginalizedparent'><aclass='marginalized'href='#arith.ops-4'>4</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5011'>#</a></div><divclass='texpara'><divid='arith.ops-4.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</span></div></div></div></div><divclass='texpara'><divid='lib:quantity,operator%_'><divid='lib:operator%,quantity_'><divid='lib:quantity,operator-__'><divid='lib:operator-,quantity__'><divid='lib:quantity,operator+__'><divid='lib:operator+,quantity__'><divclass='itemdecl'><divclass='marginalizedparent'><aclass='itemDeclLink'href='#lib:operator+,quantity__'>🔗</a></div><codeclass='itemdeclcode'><spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <ahref='qty.rep.concepts.html#concept:Representation'title='5.5.4 Concepts [qty.rep.concepts]'><spanid='conceptref:Representation____________'><spanclass='texttt'>Representation</span></span></a> Value<spanclass='anglebracket'>></span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <ahref='qty.rep.concepts.html#concept:Representation'title='5.5.4 Concepts [qty.rep.concepts]'><spanid='conceptref:Representation_____________'><spanclass='texttt'>Representation</span></span></a> Value<spanclass='anglebracket'>></span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <ahref='qty.rep.concepts.html#concept:Representation'title='5.5.4 Concepts [qty.rep.concepts]'><spanid='conceptref:Representation______________'><spanclass='texttt'>Representation</span></span></a> Value<spanclass='anglebracket'>></span>
</code></div></div></div></div></div></div></div></div><divclass='para'id='arith.ops-5'><divclass='marginalizedparent'><aclass='marginalized'href='#arith.ops-5'>5</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5043'>#</a></div><divclass='texpara'><divid='arith.ops-5.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <ahref='qty.rep.concepts.html#concept:Representation'title='5.5.4 Concepts [qty.rep.concepts]'><spanid='conceptref:Representation________________'><spanclass='texttt'>Representation</span></span></a> Value<spanclass='anglebracket'>></span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <ahref='qty.rep.concepts.html#concept:Representation'title='5.5.4 Concepts [qty.rep.concepts]'><spanid='conceptref:Representation_________________'><spanclass='texttt'>Representation</span></span></a> Value<spanclass='anglebracket'>></span>
</code></div></div></div></div></div></div></div></div><divclass='para'id='arith.ops-6'><divclass='marginalizedparent'><aclass='marginalized'href='#arith.ops-6'>6</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5068'>#</a></div><divclass='texpara'><divid='arith.ops-6.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</code></div></div></div></div></div></div><divclass='para'id='arith.ops-7'><divclass='marginalizedparent'><aclass='marginalized'href='#arith.ops-7'>7</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5086'>#</a></div><divclass='texpara'><divid='arith.ops-7.sentence-1'class='sentence'><i>Preconditions</i>: If <spanclass='texttt'>@</span> is <spanclass='texttt'><spanclass='operator'>/</span></span>, then <spanclass='texttt'>is_<spanclass='shy'></span>neq_<spanclass='shy'></span>zero<spanclass='parenthesis'>(</span>rhs<spanclass='parenthesis'>)</span></span> is <spanclass='texttt'><spanclass='literal'>true</span></span><aclass='hidden_link'href='#arith.ops-7.sentence-1'>.</a></div></div></div></div><divclass='para'id='arith.ops-8'><divclass='marginalizedparent'><aclass='marginalized'href='#arith.ops-8'>8</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5090'>#</a></div><divclass='texpara'><divid='arith.ops-8.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
lhs<spanclass='operator'>.</span>numerical_value_ref_in<spanclass='parenthesis'>(</span>unit<spanclass='parenthesis'>)</span> @ rhs<spanclass='operator'>.</span>numerical_value_ref_in<spanclass='parenthesis'>(</span>rhs<spanclass='operator'>.</span>unit<spanclass='parenthesis'>)</span>, R @ R2<spanclass='curlybracket'>}</span>;
</span></div></div></div></div><divclass='texpara'><divid='lib:quantity,operator/_'><divid='lib:operator/,quantity_'><divid='lib:quantity,operator*_'><divid='lib:operator*,quantity_'><divclass='itemdecl'><divclass='marginalizedparent'><aclass='itemDeclLink'href='#lib:operator*,quantity_'>🔗</a></div><codeclass='itemdeclcode'><spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <spanclass='keyword'>typename</span> Value<spanclass='anglebracket'>></span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <spanclass='keyword'>typename</span> Value<spanclass='anglebracket'>></span>
</code></div></div></div></div></div></div><divclass='para'id='arith.ops-9'><divclass='marginalizedparent'><aclass='marginalized'href='#arith.ops-9'>9</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5113'>#</a></div><divclass='texpara'><divid='arith.ops-9.sentence-1'class='sentence'><i>Preconditions</i>: If <spanclass='texttt'>@</span> is <spanclass='texttt'><spanclass='operator'>/</span></span>, then <spanclass='texttt'>rhs <spanclass='operator'>!</span><spanclass='operator'>=</span> representation_<spanclass='shy'></span>values<spanclass='anglebracket'><</span>Value<spanclass='anglebracket'>></span><spanclass='operator'>​::​</span>zero<spanclass='parenthesis'>(</span><spanclass='parenthesis'>)</span></span> is <spanclass='texttt'><spanclass='literal'>true</span></span><aclass='hidden_link'href='#arith.ops-9.sentence-1'>.</a></div></div></div></div><divclass='para'id='arith.ops-10'><divclass='marginalizedparent'><aclass='marginalized'href='#arith.ops-10'>10</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5117'>#</a></div><divclass='texpara'><divid='arith.ops-10.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</code></div></div></div></div></div></div><divclass='para'id='arith.ops-11'><divclass='marginalizedparent'><aclass='marginalized'href='#arith.ops-11'>11</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5139'>#</a></div><divclass='texpara'><divid='arith.ops-11.sentence-1'class='sentence'><i>Preconditions</i>: If <spanclass='texttt'>@</span> is <spanclass='texttt'><spanclass='operator'>/</span></span>, then <spanclass='texttt'>is_<spanclass='shy'></span>neq_<spanclass='shy'></span>zero<spanclass='parenthesis'>(</span>rhs<spanclass='parenthesis'>)</span></span> is <spanclass='texttt'><spanclass='literal'>true</span></span><aclass='hidden_link'href='#arith.ops-11.sentence-1'>.</a></div></div></div></div><divclass='para'id='arith.ops-12'><divclass='marginalizedparent'><aclass='marginalized'href='#arith.ops-12'>12</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5143'>#</a></div><divclass='texpara'><divid='arith.ops-12.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</span></div></div></div></div></div><divid='cmp'class='section'><h3><aclass='secnum'href='#cmp'style='min-width:80pt'>5.6.12</a> Comparison <aclass='abbr_ref'href='qty.cmp.html'>[qty.cmp]</a></h3><divclass='para'id='cmp-1'><divclass='marginalizedparent'><aclass='marginalized'href='#cmp-1'>1</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5153'>#</a></div><divclass='texpara'><divid='cmp-1.sentence-1'class='sentence'>In the following descriptions,
let <spanclass='texttt'>@</span> be the <spanclass='textsf'><i>operator</i></span><aclass='hidden_link'href='#cmp-1.sentence-1'>.</a></div></div></div><divclass='texpara'><divid='lib:quantity,operator<=>'><divid='lib:operator<=>,quantity'><divid='lib:quantity,operator=='><divid='lib:operator==,quantity'><divclass='itemdecl'><divclass='marginalizedparent'><aclass='itemDeclLink'href='#lib:operator==,quantity'>🔗</a></div><codeclass='itemdeclcode'><spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <spanclass='keyword'>auto</span> R2, <spanclass='keyword'>typename</span> Rep2<spanclass='anglebracket'>></span>
</code></div></div></div></div></div></div><divclass='para'id='cmp-2'><divclass='marginalizedparent'><aclass='marginalized'href='#cmp-2'>2</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5169'>#</a></div><divclass='texpara'><divid='cmp-2.sentence-1'class='sentence'>Let <i>C</i> be
<spanclass='texttt'>std<spanclass='operator'>​::​</span>equality_<spanclass='shy'></span>comparable</span> if <spanclass='texttt'>@</span> is <spanclass='texttt'><spanclass='operator'>=</span><spanclass='operator'>=</span></span>, and
<spanclass='texttt'>std<spanclass='operator'>​::​</span>three_<spanclass='shy'></span>way_<spanclass='shy'></span>comparable</span> if <spanclass='texttt'>@</span> is <spanclass='texttt'><spanclass='anglebracket'><</span><spanclass='operator'>=</span><spanclass='anglebracket'>></span></span><aclass='hidden_link'href='#cmp-2.sentence-1'>.</a></div></div></div></div><divclass='para'id='cmp-3'><divclass='marginalizedparent'><aclass='marginalized'href='#cmp-3'>3</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5174'>#</a></div><divclass='texpara'><divid='cmp-3.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</span></div></div></div></div><divclass='para'id='cmp-4'><divclass='marginalizedparent'><aclass='marginalized'href='#cmp-4'>4</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5184'>#</a></div><divclass='texpara'><divid='cmp-4.sentence-1'class='sentence'><i>Remarks</i>: The expression in the <spanclass='textsf'><i>requires-clause</i></span> is equivalent to:
</span></div></div></div></div><divclass='texpara'><divid='lib:quantity,operator<=>_'><divid='lib:operator<=>,quantity_'><divid='lib:quantity,operator==_'><divid='lib:operator==,quantity_'><divclass='itemdecl'><divclass='marginalizedparent'><aclass='itemDeclLink'href='#lib:operator==,quantity_'>🔗</a></div><codeclass='itemdeclcode'><spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <ahref='qty.rep.concepts.html#concept:Representation'title='5.5.4 Concepts [qty.rep.concepts]'><spanid='conceptref:Representation__________________'><spanclass='texttt'>Representation</span></span></a> Value<spanclass='anglebracket'>></span>
<spanclass='keyword'>template</span><spanclass='anglebracket'><</span>std<spanclass='operator'>::</span>derived_from<spanclass='anglebracket'><</span>quantity<spanclass='anglebracket'>></span> Q, <ahref='qty.rep.concepts.html#concept:Representation'title='5.5.4 Concepts [qty.rep.concepts]'><spanid='conceptref:Representation___________________'><spanclass='texttt'>Representation</span></span></a> Value<spanclass='anglebracket'>></span>
</code></div></div></div></div></div></div><divclass='para'id='cmp-5'><divclass='marginalizedparent'><aclass='marginalized'href='#cmp-5'>5</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5206'>#</a></div><divclass='texpara'><divid='cmp-5.sentence-1'class='sentence'>Let <i>C</i> be
<spanclass='texttt'>std<spanclass='operator'>​::​</span>equality_<spanclass='shy'></span>comparable_<spanclass='shy'></span>with</span> if <spanclass='texttt'>@</span> is <spanclass='texttt'><spanclass='operator'>=</span><spanclass='operator'>=</span></span>, and
<spanclass='texttt'>std<spanclass='operator'>​::​</span>three_<spanclass='shy'></span>way_<spanclass='shy'></span>comparable_<spanclass='shy'></span>with</span> if <spanclass='texttt'>@</span> is <spanclass='texttt'><spanclass='anglebracket'><</span><spanclass='operator'>=</span><spanclass='anglebracket'>></span></span><aclass='hidden_link'href='#cmp-5.sentence-1'>.</a></div></div></div></div><divclass='para'id='cmp-6'><divclass='marginalizedparent'><aclass='marginalized'href='#cmp-6'>6</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5211'>#</a></div><divclass='texpara'><divid='cmp-6.sentence-1'class='sentence'><i>Returns</i>: <spanclass='texttt'>lhs<spanclass='operator'>.</span>numerical_<spanclass='shy'></span>value_<spanclass='shy'></span>ref_<spanclass='shy'></span>in<spanclass='parenthesis'>(</span>unit<spanclass='parenthesis'>)</span> @ rhs</span><aclass='hidden_link'href='#cmp-6.sentence-1'>.</a></div></div></div></div><divclass='para'id='cmp-7'><divclass='marginalizedparent'><aclass='marginalized'href='#cmp-7'>7</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5215'>#</a></div><divclass='texpara'><divid='cmp-7.sentence-1'class='sentence'><i>Remarks</i>: The expression in the <spanclass='textsf'><i>requires-clause</i></span> is equivalent to:
</code></div></div></div></div></div></div></div></div></div></div></div></div></div></div><divclass='para'id='val.cmp-1'><divclass='marginalizedparent'><aclass='marginalized'href='#val.cmp-1'>1</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5241'>#</a></div><divclass='texpara'><divid='val.cmp-1.sentence-1'class='sentence'>Let <spanclass='texttt'>is_<spanclass='shy'></span><i>F</i>_<spanclass='shy'></span>zero</span> be the function name<aclass='hidden_link'href='#val.cmp-1.sentence-1'>.</a></div></div></div></div><divclass='para'id='val.cmp-2'><divclass='marginalizedparent'><aclass='marginalized'href='#val.cmp-2'>2</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5244'>#</a></div><divclass='texpara'><divid='val.cmp-2.sentence-1'class='sentence'><i>Returns</i>: <ulclass='itemize'><liid='val.cmp-2.1'><divclass='marginalizedparent'style='left:-39mm'><aclass='marginalized'href='#val.cmp-2.1'>(2.1)</a></div><divclass='texpara'><divid='val.cmp-2.1.sentence-1'class='sentence'>If <spanclass='texttt'><i>F</i></span> is <spanclass='texttt'>eq</span>, returns <spanclass='texttt'>q <spanclass='operator'>=</span><spanclass='operator'>=</span> zero<spanclass='parenthesis'>(</span><spanclass='parenthesis'>)</span></span><aclass='hidden_link'href='#val.cmp-2.1.sentence-1'>.</a></div></div></li><liid='val.cmp-2.2'><divclass='marginalizedparent'style='left:-39mm'><aclass='marginalized'href='#val.cmp-2.2'>(2.2)</a></div><divclass='texpara'><divid='val.cmp-2.2.sentence-1'class='sentence'>Otherwise, if <spanclass='texttt'><i>F</i></span> is <spanclass='texttt'>neq</span>, returns <spanclass='texttt'>q <spanclass='operator'>!</span><spanclass='operator'>=</span> zero<spanclass='parenthesis'>(</span><spanclass='parenthesis'>)</span></span><aclass='hidden_link'href='#val.cmp-2.2.sentence-1'>.</a></div></div></li><liid='val.cmp-2.3'><divclass='marginalizedparent'style='left:-39mm'><aclass='marginalized'href='#val.cmp-2.3'>(2.3)</a></div><divclass='texpara'><divid='val.cmp-2.3.sentence-1'class='sentence'>Otherwise, returns <spanclass='texttt'>is_<spanclass='shy'></span><i>F</i><spanclass='parenthesis'>(</span>q <spanclass='anglebracket'><</span><spanclass='operator'>=</span><spanclass='anglebracket'>></span> zero<spanclass='parenthesis'>(</span><spanclass='parenthesis'>)</span><spanclass='parenthesis'>)</span></span> (<ahref="https://wg21.link/compare.syn">N4971, [compare.syn]</a>)<aclass='hidden_link'href='#val.cmp-2.3.sentence-1'>.</a></div></div></li></ul></div></div></div></div><divclass='para'id='val.cmp-3'><divclass='marginalizedparent'><aclass='marginalized'href='#val.cmp-3'>3</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5255'>#</a></div><divclass='texpara'><divid='val.cmp-3.sentence-1'class='sentence'><i>Remarks</i>: Let <i>C</i> be
<spanclass='texttt'>std<spanclass='operator'>​::​</span>equality_<spanclass='shy'></span>comparable_<spanclass='shy'></span>with</span> if <i>F</i> is <spanclass='texttt'>eq</span> or <spanclass='texttt'>neq</span>, and
<spanclass='texttt'>std<spanclass='operator'>​::​</span>three_<spanclass='shy'></span>way_<spanclass='shy'></span>comparable_<spanclass='shy'></span>with</span> otherwise<aclass='hidden_link'href='#val.cmp-3.sentence-1'>.</a></div><divid='val.cmp-3.sentence-2'class='sentence'>The expression in the <spanclass='textsf'><i>requires-clause</i></span> is equivalent to:
</code></div></div></div></div><divclass='para'id='delta-1'><divclass='marginalizedparent'><aclass='marginalized'href='#delta-1'>1</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5292'>#</a></div><divclass='texpara'><divid='delta-1.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</code></div></div></div></div><divclass='para'id='non.mem.conv-3'><divclass='marginalizedparent'><aclass='marginalized'href='#non.mem.conv-3'>3</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5324'>#</a></div><divclass='texpara'><divid='non.mem.conv-3.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</code></div></div></div></div><divclass='para'id='non.mem.conv-4'><divclass='marginalizedparent'><aclass='marginalized'href='#non.mem.conv-4'>4</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5342'>#</a></div><divclass='texpara'><divid='non.mem.conv-4.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</code></div></div></div></div><divclass='para'id='non.mem.conv-5'><divclass='marginalizedparent'><aclass='marginalized'href='#non.mem.conv-5'>5</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5363'>#</a></div><divclass='texpara'><divid='non.mem.conv-5.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
</span></div></div></div></div><divclass='para'id='non.mem.conv-6'><divclass='marginalizedparent'><aclass='marginalized'href='#non.mem.conv-6'>6</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5371'>#</a></div><divclass='texpara'><divid='non.mem.conv-6.sentence-1'class='sentence'><i>Remarks</i>: The expression in the <spanclass='textsf'><i>requires-clause</i></span> is equivalent to:
</code></div></div></div></div><divclass='para'id='non.mem.conv-7'><divclass='marginalizedparent'><aclass='marginalized'href='#non.mem.conv-7'>7</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5389'>#</a></div><divclass='texpara'><divid='non.mem.conv-7.sentence-1'class='sentence'><i>Effects</i>: Equivalent to: <spanclass='texttt'><spanclass='keyword'>return</span><spanclass='texttt'><i>sudo-cast</i></span><spanclass='anglebracket'><</span>ToQ<spanclass='anglebracket'>></span><spanclass='parenthesis'>(</span>std<spanclass='operator'>​::​</span>forward<spanclass='anglebracket'><</span>FwdQ<spanclass='anglebracket'>></span><spanclass='parenthesis'>(</span>q<spanclass='parenthesis'>)</span><spanclass='parenthesis'>)</span>;</span></div></div></div></div><divclass='para'id='non.mem.conv-8'><divclass='marginalizedparent'><aclass='marginalized'href='#non.mem.conv-8'>8</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5394'>#</a></div><divclass='texpara'><divid='non.mem.conv-8.sentence-1'class='sentence'><spanclass='texttt'>quantity_<spanclass='shy'></span>cast</span> is an explicit cast that allows converting to more specific quantities<aclass='hidden_link'href='#non.mem.conv-8.sentence-1'>.</a></div><divid='non.mem.conv-example-1'class='example'><divclass='texpara'>[<i>Example <ahref='#non.mem.conv-example-1'>1</a></i>: <spanclass='codeblock'><spanclass='keyword'>auto</span> length <spanclass='operator'>=</span> isq<spanclass='operator'>::</span>length<spanclass='parenthesis'>(</span><spanclass='literal'>42</span><spanclass='operator'>*</span> m<spanclass='parenthesis'>)</span>;
</code></div></div></div></div><divclass='para'id='non.mem.conv-9'><divclass='marginalizedparent'><aclass='marginalized'href='#non.mem.conv-9'>9</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5411'>#</a></div><divclass='texpara'><divid='non.mem.conv-9.sentence-1'class='sentence'><i>Effects</i>: Equivalent to:
<spanclass='keyword'>using</span> type <spanclass='operator'>=</span> mp_units<spanclass='operator'>::</span>quantity<spanclass='anglebracket'><</span>mp_units<spanclass='operator'>::</span>get_common_reference<spanclass='parenthesis'>(</span>Q1<spanclass='operator'>::</span>reference, Q2<spanclass='operator'>::</span>reference<spanclass='parenthesis'>)</span>,