forked from mpusz/mp-units
12 lines
8.5 KiB
HTML
12 lines
8.5 KiB
HTML
<!DOCTYPE html><html lang='en'><head><title>[qty.modulus.cpo]</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.5</a> Representation <a class='abbr_ref' href='qty.rep.html#qty.modulus.cpo'>[qty.rep]</a></h2><h3 ><a class='secnum' style='min-width:80pt'>5.5.3</a> Customization point objects <a class='abbr_ref' href='qty.rep.cpos.html#qty.modulus.cpo'>[qty.rep.cpos]</a></h3><h4 ><a class='secnum' style='min-width:95pt'>5.5.3.4</a> <span class='texttt'>mp_<span class='shy'></span>units​::​modulus</span> <a class='abbr_ref'>[qty.modulus.cpo]</a></h4><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#L3851'>#</a></div><div class='texpara'><div id='1.sentence-1' class='sentence'>The name <span class='texttt'>mp_<span class='shy'></span>units<span class='operator'>​::​</span>modulus</span> denotes a customization point object (<a href="https://wg21.link/customization.point.object">N4971, [customization.point.object]</a>)<a class='hidden_link' href='#1.sentence-1'>.</a></div></div></div><div class='para' id='2'><div class='marginalizedparent'><a class='marginalized' href='#2'>2</a></div><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L3854'>#</a></div><div class='texpara'><div id='2.sentence-1' class='sentence'>Given a subexpression <span class='texttt'>E</span> with type <span class='texttt'>T</span>,
|
|
let <span class='texttt'>t</span> be an lvalue that denotes the reified object for <span class='texttt'>E</span><a class='hidden_link' href='#2.sentence-1'>.</a></div> <div id='2.sentence-2' class='sentence'>Then:
|
|
<ul class='itemize'><li id='2.1'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#2.1'>(2.1)</a></div><div class='texpara'><div id='2.1.sentence-1' class='sentence'>If <span class='texttt'>T</span> does not model <a href='qty.rep.concepts.html#concept:WeaklyRegular' title='5.5.4 Concepts [qty.rep.concepts]'><span id='conceptref:WeaklyRegular'><span class='texttt'><i >WeaklyRegular</i></span></span></a>,
|
|
<span class='texttt'>mp_<span class='shy'></span>units<span class='operator'>​::​</span>modulus<span class='parenthesis'>(</span>E<span class='parenthesis'>)</span></span> is ill-formed<a class='hidden_link' href='#2.1.sentence-1'>.</a></div></div></li><li id='2.2'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#2.2'>(2.2)</a></div><div class='texpara'><div id='2.2.sentence-1' class='sentence'>If <span class='texttt'><span class='keyword'>auto</span><span class='parenthesis'>(</span>t<span class='operator'>.</span>modulus<span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span></span> is a valid expression whose type models <a href='qty.rep.concepts.html#concept:Scalar' title='5.5.4 Concepts [qty.rep.concepts]'><span id='conceptref:Scalar'><span class='texttt'><i >Scalar</i></span></span></a>,
|
|
<span class='texttt'>mp_<span class='shy'></span>units<span class='operator'>​::​</span>modulus<span class='parenthesis'>(</span>E<span class='parenthesis'>)</span></span> is expression-equivalent to <span class='texttt'><span class='keyword'>auto</span><span class='parenthesis'>(</span>t<span class='operator'>.</span>modulus<span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span></span><a class='hidden_link' href='#2.2.sentence-1'>.</a></div></div></li><li id='2.3'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#2.3'>(2.3)</a></div><div class='texpara'><div id='2.3.sentence-1' class='sentence'>Otherwise, if <span class='texttt'>T</span> is a class or enumeration type and
|
|
<span class='texttt'><span class='keyword'>auto</span><span class='parenthesis'>(</span>modulus<span class='parenthesis'>(</span>t<span class='parenthesis'>)</span><span class='parenthesis'>)</span></span> is a valid expression whose type models <a href='qty.rep.concepts.html#concept:Scalar' title='5.5.4 Concepts [qty.rep.concepts]'><span id='conceptref:Scalar_'><span class='texttt'><i >Scalar</i></span></span></a>
|
|
where the meaning of <span class='texttt'>modulus</span> is established as-if by performing argument-dependent lookup only (<a href="https://wg21.link/basic.lookup.argdep">N4971, [basic.lookup.argdep]</a>),
|
|
then <span class='texttt'>mp_<span class='shy'></span>units<span class='operator'>​::​</span>modulus<span class='parenthesis'>(</span>E<span class='parenthesis'>)</span></span> is expression-equivalent to that expression<a class='hidden_link' href='#2.3.sentence-1'>.</a></div></div></li><li id='2.4'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#2.4'>(2.4)</a></div><div class='texpara'><div id='2.4.sentence-1' class='sentence'>If <span class='texttt'><span class='keyword'>auto</span><span class='parenthesis'>(</span>t<span class='operator'>.</span>abs<span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span></span> is a valid expression whose type models <a href='qty.rep.concepts.html#concept:Scalar' title='5.5.4 Concepts [qty.rep.concepts]'><span id='conceptref:Scalar__'><span class='texttt'><i >Scalar</i></span></span></a>,
|
|
<span class='texttt'>mp_<span class='shy'></span>units<span class='operator'>​::​</span>modulus<span class='parenthesis'>(</span>E<span class='parenthesis'>)</span></span> is expression-equivalent to <span class='texttt'><span class='keyword'>auto</span><span class='parenthesis'>(</span>t<span class='operator'>.</span>abs<span class='parenthesis'>(</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span></span><a class='hidden_link' href='#2.4.sentence-1'>.</a></div></div></li><li id='2.5'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#2.5'>(2.5)</a></div><div class='texpara'><div id='2.5.sentence-1' class='sentence'>Otherwise, if <span class='texttt'>T</span> is a class or enumeration type and
|
|
<span class='texttt'><span class='keyword'>auto</span><span class='parenthesis'>(</span>abs<span class='parenthesis'>(</span>t<span class='parenthesis'>)</span><span class='parenthesis'>)</span></span> is a valid expression whose type models <a href='qty.rep.concepts.html#concept:Scalar' title='5.5.4 Concepts [qty.rep.concepts]'><span id='conceptref:Scalar___'><span class='texttt'><i >Scalar</i></span></span></a>
|
|
where the meaning of <span class='texttt'>abs</span> is established as-if by performing argument-dependent lookup only (<a href="https://wg21.link/basic.lookup.argdep">N4971, [basic.lookup.argdep]</a>),
|
|
then <span class='texttt'>mp_<span class='shy'></span>units<span class='operator'>​::​</span>modulus<span class='parenthesis'>(</span>E<span class='parenthesis'>)</span></span> is expression-equivalent to that expression<a class='hidden_link' href='#2.5.sentence-1'>.</a></div></div></li><li id='2.6'><div class='marginalizedparent' style='left:-27mm'><a class='marginalized' href='#2.6'>(2.6)</a></div><div class='texpara'><div id='2.6.sentence-1' class='sentence'>Otherwise, <span class='texttt'>mp_<span class='shy'></span>units<span class='operator'>​::​</span>modulus<span class='parenthesis'>(</span>E<span class='parenthesis'>)</span></span> is ill-formed<a class='hidden_link' href='#2.6.sentence-1'>.</a></div></div></li></ul></div></div></div></div></body></html> |