Namespaces
Variants

std::experimental::filesystem:: is_directory

From cppreference.net
定义于头文件 <experimental/filesystem>
bool is_directory ( file_status s ) ;
(1) (filesystem TS)
bool is_directory ( const path & p ) ;
(2) (filesystem TS)
bool is_directory ( const path & p, error_code & ec ) ;
(3) (filesystem 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 作为参数构造。

参见