77 lines
6.0 KiB
HTML
77 lines
6.0 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::stacktrace_entry::source_file</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_source_file 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::stacktrace_entry::</span>source_file</h1>
|
|
<div id="bodyContent">
|
|
<div id="contentSub"><span class="subpages">< <a href="cpp.html">cpp</a>‎ | <a href="cpp-utility.html">utility</a>‎ | <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-dcl t-since-cxx23">
|
|
<td>
|
|
<div><span class="mw-geshi cpp source-cpp"><a href="cpp-string-basic_string.html"><span class="kw1230">std::<span class="me2">string</span></span></a> source_file<span class="br0">(</span><span class="br0">)</span> <span class="kw4">const</span><span class="sy4">;</span></span></div>
|
|
</td>
|
|
<td class="t-dcl-nopad"></td>
|
|
<td><span class="t-mark-rev t-since-cxx23">(C++23 起)</span></td>
|
|
</tr>
|
|
<tr class="t-dcl-sep">
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>返回词法上含有求值为 <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="sy2">*</span>this</span></span> 所表示的表达式或语句的源文件的预设或实际名,或在分配失败以外的失败,例如 <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="sy2">*</span>this</span></span> 为空时返回空字符串。</p>
|
|
<p>要么 <code>source_file</code> 返回预设源文件名且 <a href="cpp-utility-stacktrace_entry-source_line.html"><code>source_line</code></a> 返回预设行号,要么 <code>source_file</code> 返回实际源文件名且 <a href="cpp-utility-stacktrace_entry-source_line.html"><code>source_line</code></a> 返回实际行号。</p>
|
|
<h3><span class="mw-headline" id=".E5.8F.82.E6.95.B0">参数</span></h3>
|
|
<p>(无)</p>
|
|
<h3><span class="mw-headline" id=".E8.BF.94.E5.9B.9E.E5.80.BC">返回值</span></h3>
|
|
<p>成功时为指定如上的源文件名,分配失败以外的失败时为空字符串。</p>
|
|
<h3><span class="mw-headline" id=".E5.BC.82.E5.B8.B8">异常</span></h3>
|
|
<p>若不能分配内部数据结构或结果字符串的内存则抛出 <span class="t-lc"><a href="cpp-memory-new-bad_alloc.html">std::bad_alloc</a></span> 。</p>
|
|
<h3><span class="mw-headline" id=".E6.B3.A8.E8.A7.A3">注解</span></h3>
|
|
<p>源文件的预设名是预定义宏 <a href="cpp-preprocessor-replace.html"><tt>__FILE__</tt></a> 所展开的结果,而且能由 <a href="cpp-preprocessor-line.html"><tt>#line</tt></a> 指令更改。</p>
|
|
<table class="metadata plainlinks ambox mbox-small-left ambox-notice" style="">
|
|
<tr>
|
|
<td class="mbox-empty-cell"></td>
|
|
<td class="mbox-text" style="">本节未完成<br />
|
|
原因:“实际名”的定义缺失( <a rel="nofollow" class="external text" href="https://cplusplus.github.io/LWG/issue3507">LWG 问题 3507</a> )</td>
|
|
</tr>
|
|
</table>
|
|
<p>不提供对此函数的定制分配器支持,因为实现通常要求平台特定的分配、系统调用和大量 CPU 集中工作,而定制分配器不会对此函数提供便利,因为平台特定的操作耗费的时间数量级多于分配。</p>
|
|
<h3><span class="mw-headline" id=".E7.A4.BA.E4.BE.8B">示例</span></h3>
|
|
<table class="metadata plainlinks ambox mbox-small-left ambox-notice" style="">
|
|
<tr>
|
|
<td class="mbox-empty-cell"></td>
|
|
<td class="mbox-text" style="">本节未完成<br />
|
|
原因:暂无示例</td>
|
|
</tr>
|
|
</table>
|
|
<h3><span class="mw-headline" id=".E5.8F.82.E9.98.85">参阅</span></h3>
|
|
<table class="t-dsc-begin">
|
|
<tr class="t-dsc">
|
|
<td>
|
|
<div class="t-dsc-member-div">
|
|
<div><a href="cpp-utility-source_location-file_name.html"><span class="t-lines"><span>file_name</span></span></a></div>
|
|
</div>
|
|
</td>
|
|
<td>返回此对象所表示的文件名<br />
|
|
<span class="t-mark">(<code>std::source_location</code> 的公开成员函数)</span></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="visualClear"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|