Namespaces
Variants

operator<< (std::filesystem::directory_entry)

From cppreference.net
template < class CharT, class Traits >

friend std:: basic_ostream < CharT,Traits > &

operator << ( std:: basic_ostream < CharT,Traits > & os, const directory_entry & d ) ;
(C++17부터)

디렉토리 엔트리 d 에 대한 스트림 출력을 수행합니다. return os << d. path ( ) ; 와 동일합니다.

이 함수 템플릿은 일반적인 비한정(unqualified) 또는 한정된(qualified) 조회 로는 보이지 않으며, std::filesystem::directory_entry가 인자들의 연관 클래스일 때에만 인자 종속 조회(argument-dependent lookup) 에 의해 발견될 수 있습니다. 이는 using namespace std :: filesystem ; using-directive 가 존재하는 상황에서 바람직하지 않은 변환을 방지합니다.

목차

매개변수

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"

참고 항목

따옴표로 묶인 경로에 대한 스트림 입력 및 출력 수행
(함수)