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

75 lines
4.4 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::make_exception_ptr</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_make_exception_ptr 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::</span>make_exception_ptr</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></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-dsc-header">
<td>
<div>&#23450;&#20041;&#20110;&#22836;&#25991;&#20214; <code><a href="cpp-header-exception.html">&lt;exception&gt;</a></code></div>
</td>
<td></td>
<td></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> E <span class="sy1">&gt;</span><br />
<a href="cpp-error-exception_ptr.html"><span class="kw776">std::<span class="me2">exception_ptr</span></span></a> make_exception_ptr<span class="br0">(</span> E e <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-cxx11">(C++11 &#36215;)</span></td>
</tr>
<tr class="t-dcl-sep">
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p>&#21019;&#24314;&#19968;&#20010;&#20445;&#26377;&#21040; <code>e</code> &#21103;&#26412;&#30340;&#24341;&#29992;&#30340; <span class="t-lc"><a href="cpp-error-exception_ptr.html">std::exception_ptr</a></span> &#12290;&#36825;&#22914;&#21516;&#20197;&#19979;&#21015;&#20195;&#30721;&#25191;&#34892;&#65306;</p>
<div dir="ltr" class="mw-geshi" style="text-align: left;">
<div class="cpp source-cpp">
<pre class="de1"><span class="kw1">try</span> <span class="br0">{</span>
<span class="kw1">throw</span> e<span class="sy4">;</span>
<span class="br0">}</span> <span class="kw1">catch</span><span class="br0">(</span>...<span class="br0">)</span> <span class="br0">{</span>
<span class="kw1">return</span> <a href="cpp-error-current_exception.html"><span class="kw777">std::<span class="me2">current_exception</span></span></a><span class="br0">(</span><span class="br0">)</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div>
</div>
<h3><span class="mw-headline" id=".E5.8F.82.E6.95.B0">&#21442;&#25968;</span></h3>
<p>&#65288;&#26080;&#65289;</p>
<h3><span class="mw-headline" id=".E8.BF.94.E5.9B.9E.E5.80.BC">&#36820;&#22238;&#20540;</span></h3>
<p>&#20445;&#26377;&#21040; <code>e</code> &#21103;&#26412;&#65292;&#25110;&#21040; <span class="t-lc"><a href="cpp-memory-new-bad_alloc.html">std::bad_alloc</a></span> &#23454;&#20363;&#65292;&#25110;&#21040; <span class="t-lc"><a href="cpp-error-bad_exception.html">std::bad_exception</a></span> &#23454;&#20363;&#30340;&#24341;&#29992;&#30340; <span class="t-lc"><a href="cpp-error-exception_ptr.html">std::exception_ptr</a></span> &#23454;&#20363;&#65288;&#21442;&#38405; <span class="t-lc"><a href="cpp-error-current_exception.html">std::current_exception</a></span> &#65289;&#12290;</p>
<h3><span class="mw-headline" id=".E6.B3.A8.E6.84.8F">&#27880;&#24847;</span></h3>
<p>&#21442;&#25968;&#25353;&#20540;&#20256;&#36882;&#65292;&#24182;&#21463;&#20999;&#29255;&#24433;&#21709;&#12290;</p>
<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-error-current_exception.html"><span class="t-lines"><span>current_exception</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx11">(C++11)</span></span></span></div>
</div>
</td>
<td>&#25429;&#33719;&#24403;&#21069;&#24322;&#24120;&#21040; <span class="t-lc"><a href="cpp-error-exception_ptr.html">std::exception_ptr</a></span> &#20043;&#20013;<br />
<span class="t-mark">(&#20989;&#25968;)</span></td>
</tr>
</table>
</div>
<div class="visualClear"></div>
</div>
</div>
</div>
</body>
</html>