65 lines
3.9 KiB
HTML
65 lines
3.9 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::future<T>::future</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_future_future 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::future<T>::</span>future</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-future.html">future</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">future<span class="br0">(</span><span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span></span></div>
|
|
</td>
|
|
<td>(1)</td>
|
|
<td><span class="t-mark-rev t-since-cxx11">(C++11 起)</span></td>
|
|
</tr>
|
|
<tr class="t-dcl t-since-cxx11">
|
|
<td>
|
|
<div><span class="mw-geshi cpp source-cpp">future<span class="br0">(</span> future<span class="sy3">&&</span> other <span class="br0">)</span> <span class="kw1">noexcept</span><span class="sy4">;</span></span></div>
|
|
</td>
|
|
<td>(2)</td>
|
|
<td><span class="t-mark-rev t-since-cxx11">(C++11 起)</span></td>
|
|
</tr>
|
|
<tr class="t-dcl t-since-cxx11">
|
|
<td>
|
|
<div><span class="mw-geshi cpp source-cpp">future<span class="br0">(</span> <span class="kw4">const</span> future<span class="sy3">&</span> other <span class="br0">)</span> <span class="sy1">=</span> delete<span class="sy4">;</span></span></div>
|
|
</td>
|
|
<td>(3)</td>
|
|
<td><span class="t-mark-rev t-since-cxx11">(C++11 起)</span></td>
|
|
</tr>
|
|
<tr class="t-dcl-sep">
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>构造 <code>std::future</code> 对象。</p>
|
|
<div class="t-li1"><span class="t-li">1)</span> 默认构造函数。构造无共享状态的 <code>std::future</code> 。构造后, <a href="cpp-thread-future-valid.html"><span class="t-c"><span class="mw-geshi cpp source-cpp">valid<span class="br0">(</span><span class="br0">)</span></span></span></a> <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="sy1">==</span> <span class="kw2">false</span></span></span> 。</div>
|
|
<div class="t-li1"><span class="t-li">2)</span> 移动构造函数。用移动语义,以 <code>other</code> 的共享状态构造 <code>std::future</code> 。构造后 <span class="t-c"><span class="mw-geshi cpp source-cpp">other.<span class="me1">valid</span><span class="br0">(</span><span class="br0">)</span> <span class="sy1">==</span> <span class="kw2">false</span></span></span> 。</div>
|
|
<div class="t-li1"><span class="t-li">3)</span> <code>std::future</code> 不<a href="cpp-named_req-CopyConstructible.html"><span style="font-style:italic">可复制构造</span> <span style="font-family: Georgia, 'DejaVu Serif', serif; font-style:italic">(CopyConstructible)</span></a> 。</div>
|
|
<h3><span class="mw-headline" id=".E5.8F.82.E6.95.B0">参数</span></h3>
|
|
<table class="t-par-begin">
|
|
<tr class="t-par">
|
|
<td>other</td>
|
|
<td>-</td>
|
|
<td>获得共享状态来源的另一 <code>std::future</code></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="visualClear"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|