std::filesystem::is_other
std::filesystem::is_other (기타 유형 파일인지 확인)
주어진 파일 상태나 경로가 "기타 유형" 파일, 즉 존재하지만 일반 파일·디렉터리·심볼릭 링크가 아닌 파일에 해당하는지 확인하는 함수예요. C++17부터 있어요.
출처: cppreference
본문
<filesystem> 헤더에 정의돼 있어요.
bool is_other( std::filesystem::file_status s ) noexcept; // (1) C++17
bool is_other( const std::filesystem::path& p ); // (2) C++17
bool is_other( const std::filesystem::path& p, std::error_code& ec ) noexcept; // (3) C++17
주어진 파일 상태나 경로가 기타 유형의 파일, 즉 존재하지만 일반 파일도 디렉터리도 심볼릭 링크도 아닌 파일인지 검사해요.
-
exists(s) && !is_regular_file(s) && !is_directory(s) && !is_symlink(s)와 동등해요.
- 2,3) 각각
is_other(status(p))또는is_other(status(p, ec))와 동등해요.
매개변수
s— 확인할 file statusp— 검사할 경로ec— 오류 상태를 저장할 오류 코드
반환값
p가 가리키는 파일 또는 s가 나타내는 유형이 일반 파일·디렉터리·심볼릭 링크가 아니면 true, 아니면 false예요. 예외 없는 버전은 오류 시 false를 돌려줘요.
예외
noexcept로 표시되지 않은 오버로드는 메모리 할당이 실패하면 std::bad_alloc을 던질 수 있어요.
- 2,3) OS API 호출이 실패하면
ec에 OS 오류 코드를 설정하고, 오류가 없다면ec.clear()를 실행해요.