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

103 lines
6.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::operator&lt;&lt;(std::stacktrace_entry)</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_utility_stacktrace_entry_operator_ltlt 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>operator&lt;&lt;<small>(std::stacktrace_entry)</small></h1>
<div id="bodyContent">
<div id="contentSub"><span class="subpages">&lt; <a href="cpp.html">cpp</a>&lrm; | <a href="cpp-utility.html">utility</a>&lrm; | <a href="cpp-utility-stacktrace_entry.html">stacktrace entry</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-stacktrace.html">&lt;stacktrace&gt;</a></code></div>
</td>
<td></td>
<td></td>
</tr>
<tr class="t-dcl t-since-cxx23">
<td>
<div><span class="mw-geshi cpp source-cpp"><span class="kw1">template</span><span class="sy1">&lt;</span> <span class="kw1">class</span> CharT, <span class="kw1">class</span> Traits <span class="sy1">&gt;</span><br /></span>
<p><a href="cpp-io-basic_ostream.html"><span class="kw1715">std::<span class="me2">basic_ostream</span></span></a><span class="sy1">&lt;</span>CharT, Traits<span class="sy1">&gt;</span><span class="sy3">&amp;</span><br /></p>
&nbsp; &nbsp; operator<span class="sy1">&lt;&lt;</span><span class="br0">(</span> <a href="cpp-io-basic_ostream.html"><span class="kw1715">std::<span class="me2">basic_ostream</span></span></a><span class="sy1">&lt;</span>CharT, Traits<span class="sy1">&gt;</span><span class="sy3">&amp;</span> os, <span class="kw4">const</span> std<span class="sy4">::</span><span class="me2">stacktrace_entry</span><span class="sy3">&amp;</span> f <span class="br0">)</span><span class="sy4">;</span></div>
</td>
<td class="t-dcl-nopad"></td>
<td><span class="t-mark-rev t-since-cxx23">(C++23 &#36215;)</span></td>
</tr>
<tr class="t-dcl-sep">
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p>&#25554;&#20837; <code>f</code> &#30340;&#25551;&#36848;&#21040;&#36755;&#20986;&#27969; <code>os</code> &#20013;&#12290;&#31561;&#20215;&#20110; <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw1">return</span> os <span class="sy1">&lt;&lt;</span> <a href="cpp-string-basic_string-to_string.html"><span class="kw1265">std::<span class="me2">to_string</span></span></a><span class="br0">(</span>f<span class="br0">)</span><span class="sy4">;</span></span></span> &#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>os</td>
<td>-</td>
<td>&#36755;&#20986;&#27969;</td>
</tr>
<tr class="t-par">
<td>f</td>
<td>-</td>
<td>&#35201;&#25554;&#20837;&#20854;&#25551;&#36848;&#30340; <code>stacktrace_entry</code></td>
</tr>
</table>
<h3><span class="mw-headline" id=".E8.BF.94.E5.9B.9E.E5.80.BC">&#36820;&#22238;&#20540;</span></h3>
<p><code>os</code> &#12290;</p>
<h3><span class="mw-headline" id=".E5.BC.82.E5.B8.B8">&#24322;&#24120;</span></h3>
<p>&#21487;&#33021;&#25243;&#20986;&#23454;&#29616;&#23450;&#20041;&#30340;&#24322;&#24120;&#12290;</p>
<h3><span class="mw-headline" id=".E6.B3.A8.E8.A7.A3">&#27880;&#35299;</span></h3>
<p>&#30001;&#20110; <span class="t-lc"><a href="cpp-string-basic_string.html">std::string</a></span> &#21482;&#33021;&#30001; <span class="t-lc"><a href="cpp-io-basic_ostream.html">std::ostream</a></span> &#36755;&#20986;&#65288;&#20363;&#22914;&#19981;&#33021;&#30001; <span class="t-lc"><a href="cpp-io-basic_ostream.html">std::wostream</a></span> &#65289;&#65292;&#36825;&#31561;&#25928;&#22320;&#35201;&#27714; <code>os</code> &#30340;&#31867;&#22411;&#20026; <span class="t-c"><span class="mw-geshi cpp source-cpp"><a href="cpp-io-basic_ostream.html"><span class="kw1729">std::<span class="me2">ostream</span></span></a><span class="sy3">&amp;</span></span></span> &#12290;</p>
<h3><span class="mw-headline" id=".E7.A4.BA.E4.BE.8B">&#31034;&#20363;</span></h3>
<div class="t-example">
<div class="t-example-live-link"></div>
<div dir="ltr" class="mw-geshi" style="text-align: left;">
<div class="cpp source-cpp">
<pre class="de1"><span class="co2">#include &lt;stacktrace&gt;</span>
<span class="co2">#include &lt;iostream&gt;</span>
<span class="kw4">int</span> main<span class="br0">(</span><span class="br0">)</span>
<span class="br0">{</span>
<span class="kw1">for</span> <span class="br0">(</span><span class="kw4">const</span> <span class="kw4">auto</span> <span class="sy3">&amp;</span>f <span class="sy4">:</span> std<span class="sy4">::</span><span class="me2">stacktrace</span><span class="sy4">::</span><span class="me2">current</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span>
<a href="cpp-io-cout.html"><span class="kw1758">std::<span class="me2">cout</span></span></a> <span class="sy1">&lt;&lt;</span> f <span class="sy1">&lt;&lt;</span> <span class="st0">&#39;<span class="es1">\n</span>&#39;</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div>
</div>
<p>&#21487;&#33021;&#30340;&#36755;&#20986;&#65306;</p>
<div dir="ltr" class="mw-geshi" style="text-align: left;">
<div class="text source-text">
<pre class="de1">0x0000000000402AA7 in ./prog.exe
__libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
0x00000000004029B9 in ./prog.exe</pre></div>
</div>
</div>
<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-utility-basic_stacktrace-operator_ltlt.html"><span class="t-lines"><span>operator&lt;&lt;</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx23">(C++23)</span></span></span></div>
</div>
</td>
<td>&#36827;&#34892; <code>basic_stracktrace</code> &#30340;&#27969;&#36755;&#20986;<br />
<span class="t-mark">(&#20989;&#25968;&#27169;&#26495;)</span></td>
</tr>
</table>
</div>
<div class="visualClear"></div>
</div>
</div>
</div>
</body>
</html>