68 lines
4.7 KiB
HTML
68 lines
4.7 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::error_condition::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_error_error_condition_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::error_condition::</span>operator=</h1>
|
|
<div id="bodyContent">
|
|
<div id="contentSub"><span class="subpages">< <a href="cpp.html">cpp</a>‎ | <a href="cpp-error.html">error</a>‎ | <a href="cpp-error-error_condition.html">error condition</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">
|
|
<td>
|
|
<div><span class="mw-geshi cpp source-cpp">error_condition<span class="sy3">&</span> operator<span class="sy1">=</span><span class="br0">(</span> <span class="kw4">const</span> error_condition<span class="sy3">&</span> other <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><br />
|
|
<span class="t-mark">(隐式声明)</span></td>
|
|
</tr>
|
|
<tr class="t-dcl t-since-cxx11">
|
|
<td>
|
|
<div><span class="mw-geshi cpp source-cpp"><span class="kw1">template</span><span class="sy1"><</span> <span class="kw1">class</span> ErrorConditionEnum <span class="sy1">></span><br />
|
|
error_condition<span class="sy3">&</span> operator<span class="sy1">=</span><span class="br0">(</span> ErrorConditionEnum e <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-sep">
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>赋值内容给 error_condition 。</p>
|
|
<div class="t-li1"><span class="t-li">1)</span> 复制赋值运算符。赋值 <code>other</code> 的内容。</div>
|
|
<div class="t-li1"><span class="t-li">2)</span> 为枚举 <code>e</code> 赋值 error_condition for enum 。等效于对 <code>e</code> 调用<a href="cpp-language-adl.html">实参依赖查找</a>所找到的 <code>make_error_condition</code> 。此重载仅若 <span class="t-c"><span class="mw-geshi cpp source-cpp"><a href="cpp-error-error_condition-is_error_condition_enum.html"><span class="kw875">std::<span class="me2">is_error_condition_enum</span></span></a><span class="sy1"><</span>ErrorConditionEnum<span class="sy1">></span><span class="sy4">::</span><span class="me2">value</span></span></span> 为 <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw2">true</span></span></span> 才参与重载决议。</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>用以赋值的另一 error_condition</td>
|
|
</tr>
|
|
<tr class="t-par">
|
|
<td>e</td>
|
|
<td>-</td>
|
|
<td>错误条件枚举</td>
|
|
</tr>
|
|
</table>
|
|
<h3><span class="mw-headline" id=".E6.B3.A8.E8.A7.A3">注解</span></h3>
|
|
<p>最初的提案 <a rel="nofollow" class="external text" href="https://wg21.link/N2422">N2422</a> 中有意使用 ADL 所找到的 <code>make_error_condition</code> ,并且已知实现均使用它。然而,标准要求只考虑 <code>std::make_error_condition</code> 重载。此为 <a rel="nofollow" class="external text" href="https://cplusplus.github.io/LWG/issue3629">LWG 问题 3629</a> 。</p>
|
|
<h3><span class="mw-headline" id=".E8.BF.94.E5.9B.9E.E5.80.BC">返回值</span></h3>
|
|
<p><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="sy2">*</span>this</span></span> 。</p>
|
|
</div>
|
|
<div class="visualClear"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|