Files
hustoj/web/cppreference-zh/chmhelp/cpp-error-error_condition-operator=.html
2025-08-01 12:57:54 +08:00

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">&lt; <a href="cpp.html">cpp</a>&lrm; | <a href="cpp-error.html">error</a>&lrm; | <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">&amp;</span> operator<span class="sy1">=</span><span class="br0">(</span> <span class="kw4">const</span> error_condition<span class="sy3">&amp;</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 &#36215;)</span><br />
<span class="t-mark">(&#38544;&#24335;&#22768;&#26126;)</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">&lt;</span> <span class="kw1">class</span> ErrorConditionEnum <span class="sy1">&gt;</span><br />
error_condition<span class="sy3">&amp;</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 &#36215;)</span></td>
</tr>
<tr class="t-dcl-sep">
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p>&#36171;&#20540;&#20869;&#23481;&#32473; error_condition &#12290;</p>
<div class="t-li1"><span class="t-li">1)</span> &#22797;&#21046;&#36171;&#20540;&#36816;&#31639;&#31526;&#12290;&#36171;&#20540; <code>other</code> &#30340;&#20869;&#23481;&#12290;</div>
<div class="t-li1"><span class="t-li">2)</span> &#20026;&#26522;&#20030; <code>e</code> &#36171;&#20540; error_condition for enum &#12290;&#31561;&#25928;&#20110;&#23545; <code>e</code> &#35843;&#29992;<a href="cpp-language-adl.html">&#23454;&#21442;&#20381;&#36182;&#26597;&#25214;</a>&#25152;&#25214;&#21040;&#30340; <code>make_error_condition</code> &#12290;&#27492;&#37325;&#36733;&#20165;&#33509; <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">&lt;</span>ErrorConditionEnum<span class="sy1">&gt;</span><span class="sy4">::</span><span class="me2">value</span></span></span> &#20026; <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw2">true</span></span></span> &#25165;&#21442;&#19982;&#37325;&#36733;&#20915;&#35758;&#12290;</div>
<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>other</td>
<td>-</td>
<td>&#29992;&#20197;&#36171;&#20540;&#30340;&#21478;&#19968; error_condition</td>
</tr>
<tr class="t-par">
<td>e</td>
<td>-</td>
<td>&#38169;&#35823;&#26465;&#20214;&#26522;&#20030;</td>
</tr>
</table>
<h3><span class="mw-headline" id=".E6.B3.A8.E8.A7.A3">&#27880;&#35299;</span></h3>
<p>&#26368;&#21021;&#30340;&#25552;&#26696; <a rel="nofollow" class="external text" href="https://wg21.link/N2422">N2422</a> &#20013;&#26377;&#24847;&#20351;&#29992; ADL &#25152;&#25214;&#21040;&#30340; <code>make_error_condition</code> &#65292;&#24182;&#19988;&#24050;&#30693;&#23454;&#29616;&#22343;&#20351;&#29992;&#23427;&#12290;&#28982;&#32780;&#65292;&#26631;&#20934;&#35201;&#27714;&#21482;&#32771;&#34385; <code>std::make_error_condition</code> &#37325;&#36733;&#12290;&#27492;&#20026; <a rel="nofollow" class="external text" href="https://cplusplus.github.io/LWG/issue3629">LWG &#38382;&#39064; 3629</a> &#12290;</p>
<h3><span class="mw-headline" id=".E8.BF.94.E5.9B.9E.E5.80.BC">&#36820;&#22238;&#20540;</span></h3>
<p><span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="sy2">*</span>this</span></span> &#12290;</p>
</div>
<div class="visualClear"></div>
</div>
</div>
</div>
</body>
</html>