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 起) |
构造一个新的
filesystem_error
对象。
what()
返回的字符串包含
what_arg
(假设其不包含嵌入的空字符)。如果未提供任一或两个
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
对象。
示例
|
本节内容不完整
原因:缺少示例 |