Namespaces
Variants

std::filesystem::filesystem_error:: filesystem_error

From cppreference.net
filesystem_error ( const std:: string & what_arg,
std:: error_code ec ) ;
(1) (C++17부터)
filesystem_error ( const std:: string & what_arg,

const std:: filesystem :: path & p1,

std:: error_code ec ) ;
(2) (C++17부터)
filesystem_error ( const std:: string & what_arg,

const std:: filesystem :: path & p1,
const std:: filesystem :: path & p2,

std:: error_code ec ) ;
(3) (C++17부터)
filesystem_error ( const filesystem_error & other ) noexcept ;
(4) (C++17부터)

새로운 filesystem_error 객체를 생성합니다.

1-3) 오류 코드가 ec 로 설정되고, 선택적으로 오류를 발생시킨 연산과 관련된 경로들이 p1 p2 로 설정됩니다. what() 함수는 생성 후 what_arg (내장된 null 문자를 포함하지 않는다고 가정할 때)를 포함하는 문자열을 반환합니다. path 인수가 하나 또는 둘 모두 제공되지 않으면, 대신 null path 가 사용됩니다.
4) 복사 생성자. other 의 내용으로 초기화합니다. * this other 모두 동적 타입 std::filesystem_error::filesystem_error 를 갖는 경우 std:: strcmp ( what ( ) , other. what ( ) ) == 0 입니다.

매개변수

what_arg - 설명 문자열
ec - 특정 운영 체제 종속 오류에 대한 에러 코드
p1, p2 - 시스템 오류를 발생시킨 작업과 관련된 경로
other - 복사할 다른 filesystem_error 객체

참고 사항

std::filesystem::filesystem_error 를 복사하는 것이 예외를 던지는 것을 허용하지 않기 때문에, 설명 문자열은 일반적으로 별도로 할당된 참조 카운트 저장소에 내부적으로 저장됩니다. 이것이 또한 std::string&& 를 취하는 생성자가 존재하지 않는 이유이기도 합니다: 어차피 내용을 복사해야 하기 때문입니다.

일반적인 구현에서는 또한 path 객체들을 참조 카운트가 적용된 저장소에 보관합니다. 이 객체들은 path1() path2() 에 의해 참조됩니다.

예제