std::experimental::filesystem::is_regular_file
来自 cppreference.cn
< cpp | experimental | fs
定义于头文件 <experimental/filesystem> |
||
bool is_regular_file( file_status s ); |
(1) | (文件系统 TS) |
bool is_regular_file( const path& p ); |
(2) | (文件系统 TS) |
bool is_regular_file( const path& p, error_code& ec ); |
(3) | (文件系统 TS) |
检查给定的文件状态或路径是否对应于常规文件。
1) 等价于 s.type() == file_type::regular。
2) 等价于 is_regular_file(status(p))。
3) 等价于 is_regular_file(status(p, ec))。如果发生错误,则返回 false 并将 ec 设置为适当的错误代码。否则,通过调用 ec.clear() 清除 ec。
本节内容不完整 原因:规范指出 (2) 在 status(p) 将抛出 filesystem_error 时会抛出 filesystem_error。这与其他 is_**_file 函数不同。这是否正确?如果是,理由是什么? |
内容 |
[编辑] 参数
s | - | 要检查的文件状态 |
p | - | 要检查的路径 |
ec | - | 用于存储错误状态的错误代码 |
[编辑] 返回值
true 如果给定的路径或文件状态对应于常规链接,否则为 false。
[编辑] 异常
1,3)
noexcept 规范:
noexcept
2) 如果发生错误,则抛出 filesystem_error。错误构造时使用 p 作为参数。错误代码被设置为导致失败的错误的适当错误代码。
[编辑] 参见
本节内容不完整 |