operator<< (std::filesystem::directory_entry)
|
template
<
class
CharT,
class
Traits
>
friend
std::
basic_ostream
<
CharT,Traits
>
&
|
(C++17 起) | |
对目录条目 d 执行流输出。等效于 return os << d. path ( ) ; 。
此函数模板对普通的 非限定查找 或 限定查找 不可见,仅当 std::filesystem::directory_entry 作为参数的关联类时,才能通过 实参依赖查找 找到。这可以防止在存在 using namespace std :: filesystem ; using 指令 时发生不期望的类型转换。
目录 |
参数
| os | - | 执行输出的流 |
| d | - |
待插入的
directory_entry
|
返回值
os
异常
可能抛出实现定义的异常。
示例
#include <filesystem> #include <iostream> namespace fs = std::filesystem; int main() { const auto entries = {fs::directory_entry{fs::current_path()}, fs::directory_entry{fs::temp_directory_path()}}; for (const fs::directory_entry& de : entries) std::cout << de << '\n'; }
可能的输出:
"/home/猫" "/tmp"
参见
|
(C++17)
|
对带引号的路径执行流输入和输出操作
(函数) |