Files
hustoj/web/cppreference-zh/chmhelp/cpp-experimental-propagate_const-swap.html
2025-08-01 12:57:54 +08:00

84 lines
6.2 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::experimental::propagate_const&lt;T&gt;::swap</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_experimental_propagate_const_swap 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::experimental::propagate_const&lt;T&gt;::</span>swap</h1>
<div id="bodyContent">
<div id="contentSub"><span class="subpages">&lt; <a href="cpp.html">cpp</a>&lrm; | <a href="cpp-experimental.html">experimental</a>&lrm; | <a href="cpp-experimental-propagate_const.html">propagate const</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 t-since-libfund_ts_2">
<td>
<div><span class="mw-geshi cpp source-cpp"><span class="kw4">constexpr</span> <span class="kw4">void</span> swap<span class="br0">(</span>propagate_const <span class="sy3">&amp;</span> pt<span class="br0">)</span> <span class="kw1">noexcept</span><span class="br0">(</span><span class="coMULTI">/* see below */</span><span class="br0">)</span><span class="sy4">;</span></span></div>
</td>
<td class="t-dcl-nopad"></td>
<td><span class="t-mark-rev t-since-libfund-ts-2 t-mark-ts">(&#24211;&#22522;&#30784; TS v2)</span></td>
</tr>
<tr class="t-dcl-sep">
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p>&#20132;&#25442;&#34987;&#21253;&#35013;&#25351;&#38024;&#21644; <code>pt</code> &#30340;&#34987;&#21253;&#35013;&#25351;&#38024;&#12290;&#20196; <code>t_</code> &#25351;&#20195;&#31169;&#26377;&#25968;&#25454;&#25104;&#21592;&#65292;&#21363;&#34987;&#21253;&#35013;&#30340;&#20223;&#25351;&#38024;&#23545;&#35937;&#65292;&#21017;&#27492;&#20989;&#25968;&#31561;&#20215;&#20110; <span class="t-c"><span class="mw-geshi cpp source-cpp">swap<span class="br0">(</span>t_, pt.<span class="me1">t_</span><span class="br0">)</span></span></span> &#65292;&#20854;&#20013;&#23545; <code>swap</code> &#30340;&#37325;&#36733;&#20915;&#35758;&#22312; <span class="t-lc"><a href="cpp-algorithm-swap.html">std::swap</a></span> &#19982;&#36890;&#24120;&#26597;&#25214;&#35268;&#21017;&#25152;&#25214;&#21040;&#30340;&#20219;&#20309;&#22768;&#26126;&#20043;&#38388;&#36827;&#34892;&#65292;&#22914;&#22312;<a href="cpp-named_req-Swappable.html"><span style="font-style:italic">&#21487;&#20132;&#25442;</span> <span style="font-family: Georgia, &#39;DejaVu Serif&#39;, serif; font-style:italic">(Swappable)</span></a> &#20013;&#25551;&#36848;&#12290;</p>
<p>&#33509; <code>T</code> &#30340;&#24038;&#20540;&#19981;&#28385;&#36275;<a href="cpp-named_req-Swappable.html"><span style="font-style:italic">&#21487;&#20132;&#25442;</span> <span style="font-family: Georgia, &#39;DejaVu Serif&#39;, serif; font-style:italic">(Swappable)</span></a> &#21017;&#34892;&#20026;&#26410;&#23450;&#20041;&#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>pt</td>
<td>-</td>
<td>&#35201;&#19982;&#20043;&#20132;&#25442;&#30340;&#21478;&#19968; <code>propagate_const</code> &#23545;&#35937;</td>
</tr>
</table>
<h3><span class="mw-headline" id=".E5.BC.82.E5.B8.B8">&#24322;&#24120;</span></h3>
<table class="t-rev-begin">
<tr class="t-rev t-since-libfund_ts_2">
<td>
<div class="t-noexcept-full"><a href="cpp-language-noexcept_spec.html"><tt>noexcept</tt></a> &#35828;&#26126;&#65306;&nbsp;&nbsp;
<div class="t-noexcept-box"><span class="t-cc"><span class="mw-geshi cpp source-cpp"><span class="kw1">noexcept</span><span class="br0">(</span><span class="kw1">noexcept</span><span class="br0">(</span>swap<span class="br0">(</span>t_, pt.<span class="me1">t_</span><span class="br0">)</span><span class="br0">)</span><span class="br0">)</span></span></span></div>
</div>
&#24322;&#24120;&#35828;&#26126;&#20013;&#26631;&#35782;&#31526; <code>swap</code> &#30340;&#26597;&#25214;&#25214;&#21040;&#19978;&#36848;&#30340;&#37325;&#36733;&#65292;&#24182;&#19988;&#19981;&#25214;&#21040;&#25104;&#21592;&#20989;&#25968;&#33258;&#36523;&#65292;&#20351;&#24471;&#24322;&#24120;&#35828;&#26126;&#31561;&#20215;&#20110; C++17 <span class="t-lc"><a href="cpp-types-is_swappable.html">std::is_nothrow_swappable</a></span> &#12290;</td>
<td><span class="t-mark-rev t-since-libfund-ts-2 t-mark-ts">(&#24211;&#22522;&#30784; TS v2)</span></td>
</tr>
<tr class="t-rev t-since-libfund_ts_3">
<td>
<div class="t-noexcept-full"><a href="cpp-language-noexcept_spec.html"><tt>noexcept</tt></a> &#35828;&#26126;&#65306;&nbsp;&nbsp;
<div class="t-noexcept-box"><span class="t-cc"><span class="mw-geshi cpp source-cpp"><span class="kw1">noexcept</span><span class="br0">(</span><a href="cpp-types-is_swappable.html"><span class="kw577">std::<span class="me2">is_nothrow_swappable_v</span></span></a><span class="sy1">&lt;</span>T<span class="sy1">&gt;</span><span class="br0">)</span></span></span></div>
</div>
</td>
<td><span class="t-mark-rev t-since-libfund-ts-3 t-mark-ts">(&#24211;&#22522;&#30784; TS v3)</span></td>
</tr>
</table>
<h3><span class="mw-headline" id=".E7.BC.BA.E9.99.B7.E6.8A.A5.E5.91.8A">&#32570;&#38519;&#25253;&#21578;</span></h3>
<p>&#19979;&#21015;&#26356;&#25913;&#34892;&#20026;&#30340;&#32570;&#38519;&#25253;&#21578;&#36861;&#28335;&#22320;&#24212;&#29992;&#20110;&#20197;&#21069;&#20986;&#29256;&#30340; C++ &#26631;&#20934;&#12290;</p>
<table class="dsctable" style="font-size:0.8em">
<tr>
<th>DR</th>
<th>&#24212;&#29992;&#20110;</th>
<th>&#20986;&#29256;&#26102;&#30340;&#34892;&#20026;</th>
<th>&#27491;&#30830;&#34892;&#20026;</th>
</tr>
<tr>
<td><a rel="nofollow" class="external text" href="https://cplusplus.github.io/LWG/issue3413">LWG 3413</a></td>
<td>LFTSv2</td>
<td>&#24322;&#24120;&#35828;&#26126;&#20026;&#35884;&#26500;</td>
<td>&#20351;&#20043;&#20026;&#33391;&#26500;</td>
</tr>
</table>
</div>
<div class="visualClear"></div>
</div>
</div>
</div>
</body>
</html>