163 lines
8.9 KiB
HTML
163 lines
8.9 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::filesystem::filesystem_error</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_filesystem_filesystem_error 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::filesystem::</span>filesystem_error</h1>
|
|
<div id="bodyContent">
|
|
<div id="contentSub"><span class="subpages">< <a href="cpp.html">cpp</a>‎ | <a href="cpp-filesystem.html">filesystem</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>定义于头文件 <code><a href="cpp-header-filesystem.html"><filesystem></a></code></div>
|
|
</td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
<tr class="t-dcl t-since-cxx17">
|
|
<td>
|
|
<div><span class="mw-geshi cpp source-cpp"><span class="kw1">class</span> filesystem_error<span class="sy4">;</span></span></div>
|
|
</td>
|
|
<td class="t-dcl-nopad"></td>
|
|
<td><span class="t-mark-rev t-since-cxx17">(C++17 起)</span></td>
|
|
</tr>
|
|
<tr class="t-dcl-sep">
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>类 <code>std::filesystem::filesystem_error</code> 定义文件系统库中函数的抛出版重载所抛出的异常对象。</p>
|
|
<div class="t-inheritance-diagram">
|
|
<div class="center">
|
|
<div class="noresize" style="height: 40px; width: 513px;"><map name="ImageMap_1_316919110" id="ImageMap_1_316919110">
|
|
<area href="cpp-error-exception.html" shape="rect" coords="4,4,107,36" alt="cpp/error/exception" />
|
|
<area href="cpp-error-runtime_error.html" shape="rect" coords="134,4,237,36" alt="cpp/error/runtime error" />
|
|
<area href="cpp-error-system_error.html" shape="rect" coords="264,4,367,36" alt="cpp/error/system error" /></map><img alt="std-filesystem-filesystem error-inheritance.svg" src="std-filesystem-filesystem_error-inheritance.svg" width="513" height="40" usemap="#ImageMap_1_316919110" /></div>
|
|
</div>
|
|
<div style="text-align:center;">
|
|
<p><span style="font-size:0.7em; line-height:130%">继承图</span></p>
|
|
</div>
|
|
</div>
|
|
<h3><span class="mw-headline" id=".E6.88.90.E5.91.98.E5.87.BD.E6.95.B0">成员函数</span></h3>
|
|
<table class="t-dsc-begin">
|
|
<tr class="t-dsc">
|
|
<td>
|
|
<div class="t-dsc-member-div t-dsc-member-nobold-div">
|
|
<div><a href="cpp-filesystem-filesystem_error-filesystem_error.html"><span class="t-lines"><span>(构造函数)</span></span></a></div>
|
|
</div>
|
|
</td>
|
|
<td>构造异常对象<br />
|
|
<span class="t-mark">(公开成员函数)</span></td>
|
|
</tr>
|
|
<tr class="t-dsc">
|
|
<td>
|
|
<div class="t-dsc-member-div">
|
|
<div><a href="https://zh.cppreference.com/w/cpp/filesystem/filesystem_error/operator%3D" title="cpp/filesystem/filesystem error/operator="><span class="t-lines"><span>operator=</span></span></a></div>
|
|
</div>
|
|
</td>
|
|
<td>替换异常对象<br />
|
|
<span class="t-mark">(公开成员函数)</span></td>
|
|
</tr>
|
|
<tr class="t-dsc">
|
|
<td>
|
|
<div class="t-dsc-member-div">
|
|
<div><a href="cpp-filesystem-filesystem_error-path.html"><span class="t-lines"><span>path1</span><span>path2</span></span></a></div>
|
|
</div>
|
|
</td>
|
|
<td>返回导致错误的操作所涉及的路径<br />
|
|
<span class="t-mark">(公开成员函数)</span></td>
|
|
</tr>
|
|
<tr class="t-dsc">
|
|
<td>
|
|
<div class="t-dsc-member-div">
|
|
<div><a href="cpp-filesystem-filesystem_error-what.html"><span class="t-lines"><span>what</span></span></a></div>
|
|
</div>
|
|
</td>
|
|
<td>返回解释性字符串<br />
|
|
<span class="t-mark">(公开成员函数)</span></td>
|
|
</tr>
|
|
</table>
|
|
<div class="t-inherited">
|
|
<h2><span class="mw-headline" id=".E7.BB.A7.E6.89.BF.E8.87.AA_std::system_error">继承自 <a href="cpp-error-system_error.html"><span style="font-size:0.7em; line-height:130%">std::</span>system_error</a></span></h2>
|
|
<h3><span class="mw-headline" id=".E6.88.90.E5.91.98.E5.87.BD.E6.95.B0_2">成员函数</span></h3>
|
|
<table class="t-dsc-begin">
|
|
<tr class="t-dsc">
|
|
<td>
|
|
<div class="t-dsc-member-div">
|
|
<div><a href="cpp-error-system_error-code.html"><span class="t-lines"><span>code</span></span></a></div>
|
|
</div>
|
|
</td>
|
|
<td>返回错误码<br />
|
|
<span class="t-mark">(<code>std::system_error</code> 的公开成员函数)</span></td>
|
|
</tr>
|
|
<tr class="t-dsc">
|
|
<td>
|
|
<div class="t-dsc-member-div">
|
|
<div><a href="cpp-error-system_error-what.html"><span class="t-lines"><span>what</span></span></a></div>
|
|
<div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div>
|
|
</div>
|
|
</td>
|
|
<td>返回解释性字符串<br />
|
|
<span class="t-mark">(<code>std::system_error</code> 的虚公开成员函数)</span></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="t-inherited">
|
|
<h2><span class="mw-headline" id=".E7.BB.A7.E6.89.BF.E8.87.AA_std::runtime_error">继承自 <a href="cpp-error-runtime_error.html"><span style="font-size:0.7em; line-height:130%">std::</span>runtime_error</a></span></h2>
|
|
<p><br /></p>
|
|
</div>
|
|
<div class="t-inherited">
|
|
<h2><span class="mw-headline" id=".E7.BB.A7.E6.89.BF.E8.87.AA_std::exception">继承自 <a href="cpp-error-exception.html"><span style="font-size:0.7em; line-height:130%">std::</span>exception</a></span></h2>
|
|
<h3><span class="mw-headline" id=".E6.88.90.E5.91.98.E5.87.BD.E6.95.B0_3">成员函数</span></h3>
|
|
<table class="t-dsc-begin">
|
|
<tr class="t-dsc">
|
|
<td>
|
|
<div class="t-dsc-member-div t-dsc-member-nobold-div">
|
|
<div><a href="cpp-error-exception-~exception.html"><span class="t-lines"><span>(析构函数)</span></span></a></div>
|
|
<div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div>
|
|
</div>
|
|
</td>
|
|
<td>析构该异常对象<br />
|
|
<span class="t-mark">(<code>std::exception</code> 的虚公开成员函数)</span></td>
|
|
</tr>
|
|
<tr class="t-dsc">
|
|
<td>
|
|
<div class="t-dsc-member-div">
|
|
<div><a href="cpp-error-exception-what.html"><span class="t-lines"><span>what</span></span></a></div>
|
|
<div><span class="t-lines"><span><span class="t-cmark">[虚]</span></span></span></div>
|
|
</div>
|
|
</td>
|
|
<td>返回解释性字符串<br />
|
|
<span class="t-mark">(<code>std::exception</code> 的虚公开成员函数)</span></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<h3><span class="mw-headline" id=".E6.B3.A8.E8.A7.A3">注解</span></h3>
|
|
<p>为确保 <code>filesystem_error</code> 的复制函数为 noexcept ,典型实现将保有 <span class="t-lc"><a href="cpp-filesystem-filesystem_error-what.html">what()</a></span> 的返回值的对象和 <span class="t-lc"><a href="cpp-filesystem-filesystem_error-path.html">path1()</a></span> 与 <span class="t-lc"><a href="cpp-filesystem-filesystem_error-path.html">path2()</a></span> 所分别引用的二个 <span class="t-lc"><a href="cpp-filesystem-path.html">std::filesystem::path</a></span> 对象存储于分离分配的引用计数存储。</p>
|
|
<p>当前 <a rel="nofollow" class="external text" href="https://github.com/microsoft/STL/blob/master/stl/inc/filesystem#L1749">MS STL 实现</a>不合标准:上述对象被直接存储在 <code>filesystem</code> 对象中,这使得复制函数不是 noexcept 。</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>
|
|
</div>
|
|
<div class="visualClear"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|