Files
mp-units/HEAD/api_reference/gen/qty.conv.ops.html
T

17 lines
7.2 KiB
HTML

<!DOCTYPE html><html lang='en'><head><title>[qty.conv.ops]</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.6</a> Quantity <a class='abbr_ref' href='qty.html#conv.ops'>[qty]</a></h2><h3 ><a class='secnum' style='min-width:80pt'>5.6.8</a> Conversion operations <a class='abbr_ref'>[qty.conv.ops]</a></h3><div class='texpara'><div id='lib:quantity,operator_constructible_from<Rep>'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:quantity,operator_constructible_from%3cRep%3e'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'>&lt;</span><span class='keyword'>typename</span> V_, std<span class='operator'>::</span>constructible_from<span class='anglebracket'>&lt;</span>Rep<span class='anglebracket'>&gt;</span> Value <span class='operator'>=</span> std<span class='operator'>::</span>remove_cvref_t<span class='anglebracket'>&lt;</span>V_<span class='anglebracket'>&gt;</span><span class='anglebracket'>&gt;</span>
<span class='keyword'>requires</span><span class='parenthesis'>(</span>unit <span class='operator'>=</span><span class='operator'>=</span> <span class='operator'>::</span>mp_units<span class='operator'>::</span>one<span class='parenthesis'>)</span>
<span class='keyword'>explicit</span> <span class='keyword'>operator</span> V_<span class='parenthesis'>(</span><span class='parenthesis'>)</span> <span class='keyword'>const</span> <span class='operator'>&amp;</span> <span class='keyword'>noexcept</span>;
</code></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#L4738'>#</a></div><div class='texpara'><div id='1.sentence-1' class='sentence'><i >Returns</i>: <span class='texttt'><i >numerical-value</i></span><a class='hidden_link' href='#1.sentence-1'>.</a></div></div></div></div><div class='texpara'><div id='lib:quantity,operator_QuantityLike'><div class='itemdecl'><div class='marginalizedparent'><a class='itemDeclLink' href='#lib:quantity,operator_QuantityLike'>🔗</a></div><code class='itemdeclcode'><span class='keyword'>template</span><span class='anglebracket'>&lt;</span><span class='keyword'>typename</span> Q_, <a href='qty.like.html#concept:QuantityLike' title='5.6.2&emsp;Interoperability&emsp;[qty.like]'><span id='conceptref:QuantityLike'><span class='texttt'>QuantityLike</span></span></a> Q <span class='operator'>=</span> std<span class='operator'>::</span>remove_cvref_t<span class='anglebracket'>&lt;</span>Q_<span class='anglebracket'>&gt;</span><span class='anglebracket'>&gt;</span>
<span class='keyword'>requires</span> <a class='index' id='conceptref:QuantityConvertibleTo'></a><span class='texttt'><i >QuantityConvertibleTo</i></span><span class='anglebracket'>&lt;</span>quantity, <span class='texttt'><i >quantity-like-type</i></span><span class='anglebracket'>&lt;</span>Q<span class='anglebracket'>&gt;</span><span class='anglebracket'>&gt;</span>
<span class='keyword'>constexpr</span> <span class='keyword'>explicit</span><span class='parenthesis'>(</span><i ><span class='texttt'>see below</span></i><span class='parenthesis'>)</span> <span class='keyword'>operator</span> Q_<span class='parenthesis'>(</span><span class='parenthesis'>)</span> <span class='keyword'>const</span> <span class='keyword'>noexcept</span><span class='parenthesis'>(</span><i ><span class='texttt'>see below</span></i><span class='parenthesis'>)</span>;
</code></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#L4751'>#</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> quantity_like_traits<span class='anglebracket'>&lt;</span>Q<span class='anglebracket'>&gt;</span><span class='operator'>::</span>from_numerical_value<span class='parenthesis'>(</span>
numerical_value_in<span class='parenthesis'>(</span>get_unit<span class='parenthesis'>(</span>quantity_like_traits<span class='anglebracket'>&lt;</span>Q<span class='anglebracket'>&gt;</span><span class='operator'>::</span>reference<span class='parenthesis'>)</span><span class='parenthesis'>)</span><span class='parenthesis'>)</span>;
</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#L4759'>#</a></div><div class='texpara'><div id='3.sentence-1' class='sentence'><i >Remarks</i>: The expression inside <span class='texttt'><span class='keyword'>explicit</span></span> is equivalent to:
<span class='codeblock'>quantity_like_traits<span class='anglebracket'>&lt;</span>Q<span class='anglebracket'>&gt;</span><span class='operator'>::</span>explicit_export <span class='operator'>|</span><span class='operator'>|</span>
<span class='operator'>!</span>std<span class='operator'>::</span>convertible_to<span class='anglebracket'>&lt;</span>Rep, <span class='keyword'>typename</span> quantity_like_traits<span class='anglebracket'>&lt;</span>Q<span class='anglebracket'>&gt;</span><span class='operator'>::</span>rep<span class='anglebracket'>&gt;</span>
</span></div> <div id='3.sentence-2' class='sentence'>
The exception specification is equivalent to:
<span class='codeblock'><span class='keyword'>noexcept</span><span class='parenthesis'>(</span>quantity_like_traits<span class='anglebracket'>&lt;</span>Q<span class='anglebracket'>&gt;</span><span class='operator'>::</span>from_numerical_value<span class='parenthesis'>(</span><i >numerical-value</i><span class='parenthesis'>)</span><span class='parenthesis'>)</span> <span class='operator'>&amp;</span><span class='operator'>&amp;</span>
std<span class='operator'>::</span>is_nothrow_copy_constructible_v<span class='anglebracket'>&lt;</span>rep<span class='anglebracket'>&gt;</span>
</span></div></div></div></div></div></body></html>