Files
hustoj/web/cppreference-zh/chmhelp/cpp-thread-packaged_task-operator().html
2025-08-01 12:57:54 +08:00

91 lines
5.3 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::packaged_task&lt;R(Args...)&gt;::operator()</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_packaged_task_operator 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::packaged_task&lt;R(Args...)&gt;::</span>operator()</h1>
<div id="bodyContent">
<div id="contentSub"><span class="subpages">&lt; <a href="cpp.html">cpp</a>&lrm; | <a href="cpp-thread.html">thread</a>&lrm; | <a href="cpp-thread-packaged_task.html">packaged task</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-cxx11">
<td>
<div><span class="mw-geshi cpp source-cpp"><span class="kw4">void</span> operator<span class="br0">(</span><span class="br0">)</span><span class="br0">(</span> ArgTypes... <span class="me1">args</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-cxx11">(C++11 &#36215;)</span></td>
</tr>
<tr class="t-dcl-sep">
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p>&#20197; <code>args</code> &#20026;&#21442;&#25968;&#35843;&#29992;&#23384;&#20648;&#30340;&#20219;&#21153;&#12290;&#20219;&#21153;&#36820;&#22238;&#20540;&#25110;&#20219;&#20309;&#25243;&#20986;&#30340;&#24322;&#24120;&#34987;&#23384;&#20648;&#20110;&#20849;&#20139;&#29366;&#24577;&#12290;&#20196;&#20849;&#20139;&#29366;&#24577;&#23601;&#32490;&#65292;&#24182;&#35299;&#38500;&#38459;&#22622;&#20219;&#20309;&#31561;&#24453;&#27492;&#25805;&#20316;&#30340;&#32447;&#31243;&#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>args</td>
<td>-</td>
<td>&#35843;&#29992;&#26102;&#20256;&#36882;&#32473;&#23384;&#20648;&#20219;&#21153;&#30340;&#21442;&#25968;</td>
</tr>
</table>
<h3><span class="mw-headline" id=".E8.BF.94.E5.9B.9E.E5.80.BC">&#36820;&#22238;&#20540;</span></h3>
<p>&#65288;&#26080;&#65289;</p>
<h3><span class="mw-headline" id=".E5.BC.82.E5.B8.B8">&#24322;&#24120;</span></h3>
<p>&#36935;&#21040;&#19979;&#21015;&#26465;&#20214;&#26102;&#20026; <span class="t-lc"><a href="cpp-thread-future_error.html">std::future_error</a></span> &#65306;</p>
<ul>
<li>&#24050;&#35843;&#29992;&#23384;&#20648;&#30340;&#20219;&#21153;&#12290;&#35774;&#32622; error_category &#20026; <a href="cpp-thread-future_errc.html"><tt>promise_already_satisfied</tt></a> &#12290;</li>
<li><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="sy2">*</span>this</span></span> &#26080;&#20849;&#20139;&#29366;&#24577;&#12290;&#35774;&#32622; error_category &#20026; <a href="cpp-thread-future_errc.html"><tt>no_state</tt></a> &#12290;</li>
</ul>
<h3><span class="mw-headline" id=".E6.B3.A8.E6.84.8F">&#27880;&#24847;</span></h3>
<table class="t-rev-begin">
<tr class="t-rev t-until-cxx14">
<td>
<p>&#23545; <code>operator()</code> &#30340;&#25104;&#21151;&#35843;&#29992;&#21516;&#27493;&#20110;&#23545;&#20219;&#20309;&#19982; <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="sy2">*</span>this</span></span> &#20849;&#20139;&#20854;&#20849;&#20139;&#29366;&#24577;&#30340; <span class="t-lc"><a href="cpp-thread-future.html">std::future</a></span> &#25110; <span class="t-lc"><a href="cpp-thread-shared_future.html">std::shared_future</a></span> &#30340;&#20219;&#20309;&#25104;&#21592;&#20989;&#25968;&#35843;&#29992;&#12290;</p>
</td>
<td><span class="t-mark-rev t-until-cxx14">(C++14 &#21069;)</span></td>
</tr>
<tr class="t-rev t-since-cxx14">
<td>
<p>&#22312;&#20849;&#20139;&#29366;&#24577;&#24050;&#25552;&#20379;&#30340;&#21516;&#27493;&#20445;&#35777;&#22806;&#65292;&#26080;&#21478;&#22806;&#30340;&#21516;&#27493;&#20445;&#35777;&#12290;</p>
</td>
<td><span class="t-mark-rev t-since-cxx14">(C++14 &#36215;)</span></td>
</tr>
</table>
<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>
<h3><span class="mw-headline" id=".E5.8F.82.E9.98.85">&#21442;&#38405;</span></h3>
<table class="t-dsc-begin">
<tr class="t-dsc">
<td>
<div class="t-dsc-member-div">
<div><a href="cpp-thread-packaged_task-make_ready_at_thread_exit.html"><span class="t-lines"><span>make_ready_at_thread_exit</span></span></a></div>
</div>
</td>
<td>&#25191;&#34892;&#20989;&#25968;&#65292;&#24182;&#30830;&#20445;&#32467;&#26524;&#20165;&#22312;&#19968;&#26086;&#24403;&#21069;&#32447;&#31243;&#36864;&#20986;&#26102;&#23601;&#32490;<br />
<span class="t-mark">(&#20844;&#24320;&#25104;&#21592;&#20989;&#25968;)</span></td>
</tr>
</table>
</div>
<div class="visualClear"></div>
</div>
</div>
</div>
</body>
</html>