std::filesystem::filesystem_error::filesystem_error
filesystem_error(
const
std::string&
what_arg,
std::error_code ec ); |
(1) | (C++17 起) |
filesystem_error(
const
std::string&
what_arg,
const
std::filesystem::path&
p1, |
(2) | (C++17 起) |
filesystem_error(
const
std::string&
what_arg,
const
std::filesystem::path&
p1, |
(3) | (C++17 起) |
filesystem_error(
const
filesystem_error&
other )
noexcept;
|
(4) | (C++17 起) |
构造新的文件系统错误对象。
ec
,可选地将导致该错误的操作中设计的路径设为 p1
和 p2
。构造后
what()
返回含有 what_arg
的 string (假定它不含内嵌的空字符
)。若未提供一个或两个 path
参数,则用 path
代替。other
的内容初始化内容。若 *this
与 other
均拥有动态类型
std::filesystem_error::filesystem_error
则 std::strcmp(what(),
other.what())
== 0 。参数
what_arg | - | 解释字符串 |
ec | - | 依赖特定操作系统的错误的错误码 |
p1, p2 | - | 引发系统错误的操作中涉及的路径 |
other | - | 要复制的另一 filesystem_error 对象
|
注解
因为不容许复制 std::filesystem::filesystem_error
抛异常,解释字符串常被在内部存储于分离分配的引用计数存储。这也是无构造函数接收
std::string&&
的原因:它总是要复制内容。
典型实现亦将 path1()
与 path2()
所引用的 path
对象存储于引用计数存储。
示例
本节未完成 原因:暂无示例 |