Files
mp-units/HEAD/api_reference/gen/qty.pt.cmp.html
T

16 lines
7.0 KiB
HTML

<!DOCTYPE html><html lang='en'><head><title>[qty.pt.cmp]</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.7</a> Quantity point <a class='abbr_ref' href='qty.pt.html#cmp'>[qty.pt]</a></h2><h3 ><a class='secnum' style='min-width:80pt'>5.7.13</a> Comparison <a class='abbr_ref'>[qty.pt.cmp]</a></h3><div class='texpara'><div id='lib:quantity_point,operator<=>'><div id='lib:operator<=>,quantity_point'><div id='lib:quantity_point,operator=='><div id='lib:operator==,quantity_point'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:operator==,quantity_point'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'>&lt;</span>std<span class='operator'>::</span>derived_from<span class='anglebracket'>&lt;</span>quantity_point<span class='anglebracket'>&gt;</span> QP, <a href='qty.pt.syn.html#concept:QuantityPointOf' title='5.7.4&emsp;Class template quantity_&shy;point&emsp;[qty.pt.syn]'><span id='conceptref:QuantityPointOf'><span class='texttt'>QuantityPointOf</span></span></a><span class='anglebracket'>&lt;</span>absolute_point_origin<span class='anglebracket'>&gt;</span> QP2<span class='anglebracket'>&gt;</span>
<span class='keyword'>requires</span> <i ><span class='texttt'>see below</span></i>
<span class='keyword'>friend</span> <span class='keyword'>constexpr</span> <span class='keyword'>bool</span> <span class='keyword'>operator</span><span class='operator'>=</span><span class='operator'>=</span><span class='parenthesis'>(</span><span class='keyword'>const</span> QP<span class='operator'>&amp;</span> lhs, <span class='keyword'>const</span> QP2<span class='operator'>&amp;</span> rhs<span class='parenthesis'>)</span>;
<span class='keyword'>template</span><span class='anglebracket'>&lt;</span>std<span class='operator'>::</span>derived_from<span class='anglebracket'>&lt;</span>quantity_point<span class='anglebracket'>&gt;</span> QP, <a href='qty.pt.syn.html#concept:QuantityPointOf' title='5.7.4&emsp;Class template quantity_&shy;point&emsp;[qty.pt.syn]'><span id='conceptref:QuantityPointOf_'><span class='texttt'>QuantityPointOf</span></span></a><span class='anglebracket'>&lt;</span>absolute_point_origin<span class='anglebracket'>&gt;</span> QP2<span class='anglebracket'>&gt;</span>
<span class='keyword'>requires</span> <i ><span class='texttt'>see below</span></i>
<span class='keyword'>friend</span> <span class='keyword'>constexpr</span> <span class='keyword'>auto</span> <span class='keyword'>operator</span><span class='anglebracket'>&lt;</span><span class='operator'>=</span><span class='anglebracket'>&gt;</span><span class='parenthesis'>(</span><span class='keyword'>const</span> QP<span class='operator'>&amp;</span> lhs, <span class='keyword'>const</span> QP2<span class='operator'>&amp;</span> rhs<span class='parenthesis'>)</span>;
</code></div></div></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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L6451'>#</a></div><div class='texpara'><div id='1.sentence-1' class='sentence'>Let <span class='texttt'>@</span> be the <span class='textsf'><i >operator</i></span>, and
let <i >C</i> be
<span class='texttt'>std<span class='operator'>&#x200b;::&#x200b;</span>equality_<span class='shy'></span>comparable_<span class='shy'></span>with</span> if <span class='texttt'>@</span> is <span class='texttt'><span class='operator'>=</span><span class='operator'>=</span></span>, and
<span class='texttt'>std<span class='operator'>&#x200b;::&#x200b;</span>three_<span class='shy'></span>way_<span class='shy'></span>comparable_<span class='shy'></span>with</span> if <span class='texttt'>@</span> is <span class='texttt'><span class='anglebracket'>&lt;</span><span class='operator'>=</span><span class='anglebracket'>&gt;</span></span><a class='hidden_link' href='#1.sentence-1'>.</a></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-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L6457'>#</a></div><div class='texpara'><div id='2.sentence-1' class='sentence'><i >Effects</i>: Equivalent to:
<span class='codeblock'><span class='keyword'>return</span> lhs <span class='operator'>-</span> lhs<span class='operator'>.</span>absolute_point_origin @ rhs <span class='operator'>-</span> rhs<span class='operator'>.</span>absolute_point_origin;
</span></div></div></div></div><div class='para' id='3'><div class='marginalizedparent'><a class='marginalized' href='#3'>3</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L6464'>#</a></div><div class='texpara'><div id='3.sentence-1' class='sentence'><i >Remarks</i>: The expression in the <span class='textsf'><i >requires-clause</i></span> is equivalent to:
<span class='codeblock'><i >C</i><span class='anglebracket'>&lt;</span>quantity_type, <span class='keyword'>typename</span> QP2<span class='operator'>::</span>quantity_type<span class='anglebracket'>&gt;</span>
</span></div></div></div></div><div class='para' id='4'><div class='marginalizedparent'><a class='marginalized' href='#4'>4</a></div><div class='itemdescr'><div class='sourceLinkParent'><a class='sourceLink' href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L6471'>#</a></div><div class='texpara'><div id='4.sentence-1' class='sentence'><i >Recommended practice</i>: If the origins are equal, instead evaluate
<span class='codeblock'>lhs<span class='operator'>.</span>quantity_ref_from<span class='parenthesis'>(</span>point_origin<span class='parenthesis'>)</span> @ rhs<span class='operator'>.</span>quantity_ref_from<span class='parenthesis'>(</span>QP2<span class='operator'>::</span>point_origin<span class='parenthesis'>)</span>
</span></div></div></div></div></div></body></html>