std::experimental::filesystem::is_directory

< cpp‎ | experimental‎ | fs
在标头 <experimental/filesystem> 定义
bool is_directory( file_status s );
(1) (文件系统 TS)
bool is_directory( const path& p );
(2) (文件系统 TS)
bool is_directory( const path& p, error_code& ec );
(3) (文件系统 TS)

检查给定文件状态或路径是否对应于目录。

1) 等价于 s.type() == file_type::directory
2) 等价于 is_directory(status(p))
3) 等价于 is_directory(status(p, ec))。发生错误时返回 false

参数

s - 要检查的文件状态
p - 要查询的路径
ec - 发生错误时要修改的编码

返回值

如果给定路径或文件状态对应于某个目录则为 true,否则为 false

异常

1,3)
noexcept 规定:  
noexcept
  
2) 当发生错误时抛出 filesystem_error。以 p 为实参构造异常对象。

参阅