Files
hustoj/web/cppreference-zh/chmhelp/cpp-atomic-atomic_ref-fetch_sub.html
2025-08-01 12:57:54 +08:00

99 lines
5.8 KiB
HTML

<!DOCTYPE html>
<html lang="zh" dir="ltr" class="client-nojs" xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh">
<head><meta http-equiv="x-ua-compatible" content="ie=edge">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>std::atomic_ref&lt;T&gt;::fetch_sub</title>
<link rel="stylesheet" href="ext.css" />
<link rel="stylesheet" href="site_modules.css" />
</head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-cpp_atomic_atomic_ref_fetch_sub skin-cppreference2 action-view cpp-navbar">
<div id="cpp-content-base">
<div id="content"><a id="top"></a>
<h1 id="firstHeading" class="firstHeading"><span style="font-size:0.7em; line-height:130%">std::atomic_ref&lt;T&gt;::</span>fetch_sub</h1>
<div id="bodyContent">
<div id="contentSub"><span class="subpages">&lt; <a href="cpp.html">cpp</a>&lrm; | <a href="cpp-atomic.html">atomic</a>&lrm; | <a href="cpp-atomic-atomic_ref.html">atomic ref</a></span></div>
<div id="mw-content-text" lang="zh" dir="ltr" class="mw-content-ltr" xml:lang="zh">
<table class="t-dcl-begin">
<tbody>
<tr class="t-dcl-sep">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="t-dcl-h">
<td>
<div>&#20165;&#20026; <code>atomic_ref&lt;<i>Integral</i>&gt;</code> &#19982; <code>atomic_ref&lt;<i>Floating</i>&gt;</code> &#27169;&#26495;&#29305;&#21270;&#30340;&#25104;&#21592;</div>
</td>
<td></td>
<td></td>
</tr>
<tr class="t-dcl">
<td>
<div><span class="mw-geshi cpp source-cpp">T fetch_sub<span class="br0">(</span> T arg,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="cpp-atomic-memory_order.html"><span class="kw2092">std::<span class="me2">memory_order</span></span></a> order <span class="sy1">=</span> <a href="cpp-atomic-memory_order.html"><span class="kw2098">std::<span class="me2">memory_order_seq_cst</span></span></a> <span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span></span></div>
</td>
<td>(1)</td>
<td class="t-dcl-nopad"></td>
</tr>
<tr class="t-dcl-sep">
<td></td>
<td></td>
<td></td>
</tr>
<tr class="t-dcl-h">
<td>
<div>&#20165;&#20026; <code>atomic_ref&lt;T*&gt;</code> &#27169;&#26495;&#29305;&#21270;&#30340;&#25104;&#21592;</div>
</td>
<td></td>
<td></td>
</tr>
<tr class="t-dcl">
<td>
<div><span class="mw-geshi cpp source-cpp">T<span class="sy2">*</span> fetch_sub<span class="br0">(</span> <a href="cpp-types-ptrdiff_t.html"><span class="kw101">std::<span class="me2">ptrdiff_t</span></span></a> arg,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="cpp-atomic-memory_order.html"><span class="kw2092">std::<span class="me2">memory_order</span></span></a> order <span class="sy1">=</span> <a href="cpp-atomic-memory_order.html"><span class="kw2098">std::<span class="me2">memory_order_seq_cst</span></span></a> <span class="br0">)</span> <span class="kw4">const</span> <span class="kw1">noexcept</span><span class="sy4">;</span></span></div>
</td>
<td>(2)</td>
<td class="t-dcl-nopad"></td>
</tr>
<tr class="t-dcl-sep">
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p>&#21407;&#23376;&#22320;&#20197;&#20540;&#21644; <code>arg</code> &#30340;&#31639;&#26415;&#20943;&#27861;&#32467;&#26524;&#26367;&#25442;&#24403;&#21069;&#34987;&#24341;&#29992;&#23545;&#35937;&#30340;&#20540;&#12290;&#27492;&#25805;&#20316;&#20026;&#35835;&#20462;&#25913;&#20889;&#25805;&#20316;&#12290;&#25353;&#29031; <code>order</code> &#30340;&#20540;&#24433;&#21709;&#20869;&#23384;&#12290;</p>
<p>&#23545;&#20110;&#26377;&#31526;&#21495;&#25972;&#25968;&#31867;&#22411;&#65292;&#23450;&#20041;&#31639;&#26415;&#20026;&#20351;&#29992;&#34917;&#30721;&#12290;&#26080;&#26410;&#23450;&#20041;&#32467;&#26524;&#12290;</p>
<p>&#23545;&#20110;&#28014;&#28857;&#31867;&#22411;&#65292;&#26377;&#25928;&#30340;<a href="cpp-numeric-fenv.html">&#28014;&#28857;&#29615;&#22659;</a>&#21487;&#33021;&#24322;&#20110;&#35843;&#29992;&#26041;&#32447;&#31243;&#30340;&#28014;&#28857;&#29615;&#22659;&#12290;&#19981;&#38656;&#35201;&#25805;&#20316;&#26381;&#20174;&#23545;&#24212;&#30340; <span class="t-lc"><a href="cpp-types-numeric_limits.html">std::numeric_limits</a></span> &#29305;&#24615;&#65292;&#20294;&#40723;&#21169;&#36825;&#20040;&#20570;&#12290;&#33509;&#32467;&#26524;&#19981;&#26159;&#20854;&#31867;&#22411;&#30340;&#21487;&#34920;&#31034;&#20540;&#65292;&#21017;&#32467;&#26524;&#26410;&#25351;&#23450;&#65292;&#20294;&#25805;&#20316;&#19981;&#20250;&#21478;&#26377;&#26410;&#23450;&#20041;&#34892;&#20026;&#12290;</p>
<p>&#23545;&#20110; <code>T*</code> &#31867;&#22411;&#65292;&#32467;&#26524;&#21487;&#20197;&#20026;&#26410;&#23450;&#20041;&#30340;&#22320;&#22336;&#65292;&#20294;&#25805;&#20316;&#19981;&#20250;&#21478;&#26377;&#26410;&#23450;&#20041;&#34892;&#20026;&#12290;&#33509; <code>T</code> &#19981;&#26159;&#23545;&#35937;&#31867;&#22411;&#21017;&#31243;&#24207;&#20026;&#35884;&#26500;&#12290;</p>
<h3><span class="mw-headline" id=".E5.8F.82.E6.95.B0">&#21442;&#25968;</span></h3>
<table class="t-par-begin">
<tr class="t-par">
<td>arg</td>
<td>-</td>
<td>&#31639;&#26415;&#20943;&#27861;&#30340;&#21478;&#19968;&#21442;&#25968;</td>
</tr>
<tr class="t-par">
<td>order</td>
<td>-</td>
<td>&#26045;&#21152;&#30340;&#20869;&#23384;&#39034;&#24207;&#21046;&#32422;</td>
</tr>
</table>
<h3><span class="mw-headline" id=".E8.BF.94.E5.9B.9E.E5.80.BC">&#36820;&#22238;&#20540;</span></h3>
<p>&#34987;&#24341;&#29992;&#23545;&#35937;&#31435;&#21363;&#20110;&#27492;&#20989;&#25968;&#25928;&#26524;&#21069;&#30340;&#20540;&#12290;</p>
<h3><span class="mw-headline" id=".E7.A4.BA.E4.BE.8B">&#31034;&#20363;</span></h3>
<table class="metadata plainlinks ambox mbox-small-left ambox-notice" style="">
<tr>
<td class="mbox-empty-cell"></td>
<td class="mbox-text" style="">&#26412;&#33410;&#26410;&#23436;&#25104;<br />
&#21407;&#22240;&#65306;&#26242;&#26080;&#31034;&#20363;</td>
</tr>
</table>
</div>
<div class="visualClear"></div>
</div>
</div>
</div>
</body>
</html>