51 lines
3.0 KiB
HTML
51 lines
3.0 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>swap(std::stop_token)</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_thread_stop_token_swap2 skin-cppreference2 action-view cpp-navbar">
|
|
<div id="cpp-content-base">
|
|
<div id="content"><a id="top"></a>
|
|
<h1 id="firstHeading" class="firstHeading">swap<span style="font-size:0.7em; line-height:130%">(std::stop_token)</span></h1>
|
|
<div id="bodyContent">
|
|
<div id="contentSub"><span class="subpages">< <a href="cpp.html">cpp</a>‎ | <a href="cpp-thread.html">thread</a>‎ | <a href="cpp-thread-stop_token.html">stop token</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-cxx20">
|
|
<td>
|
|
<div><span class="mw-geshi cpp source-cpp"><span class="kw1">friend</span> <span class="kw4">void</span> swap<span class="br0">(</span> stop_token <span class="sy3">&</span>lhs, stop_token <span class="sy3">&</span>rhs <span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span></span></div>
|
|
</td>
|
|
<td class="t-dcl-nopad"></td>
|
|
<td><span class="t-mark-rev t-since-cxx20">(C++20 起)</span></td>
|
|
</tr>
|
|
<tr class="t-dcl-sep">
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>对 <span class="t-lc">std::stop_token</span> 重载 <span class="t-lc"><a href="cpp-algorithm-swap.html">std::swap</a></span> 算法。交换 <code>lhs</code> 与 <code>rhs</code> 的关联停止状态。等效地调用 <span class="t-c"><span class="mw-geshi cpp source-cpp">lhs.<span class="me1">swap</span><span class="br0">(</span>rhs<span class="br0">)</span></span></span> 。</p>
|
|
<p>此函数对通常<a href="cpp-language-unqualified_lookup.html">无限定</a>或<a href="cpp-language-qualified_lookup.html">有限定查找</a>不可见,而只能在 <code>std::stop_token</code> 为参数的关联类时由<a href="cpp-language-adl.html">实参依赖查找</a>找到。</p>
|
|
<h3><span class="mw-headline" id=".E5.8F.82.E6.95.B0">参数</span></h3>
|
|
<table class="t-par-begin">
|
|
<tr class="t-par">
|
|
<td>lhs, rhs</td>
|
|
<td>-</td>
|
|
<td>要交换的 <code>stop_token</code></td>
|
|
</tr>
|
|
</table>
|
|
<h3><span class="mw-headline" id=".E8.BF.94.E5.9B.9E.E5.80.BC">返回值</span></h3>
|
|
<p>(无)</p>
|
|
</div>
|
|
<div class="visualClear"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|