Namespaces
Variants

std:: make_error_condition (std::io_errc)

From cppreference.net
< cpp ‎ | io ‎ | io errc
std::io_errc
Non-member functions
make_error_condition (std::io_errc)
(C++11)
Helper classes
헤더에 정의됨 <ios>
std:: error_condition make_error_condition ( std:: io_errc e ) noexcept ;
(C++11부터)

std::error_condition 객체를 std::io_errc 타입의 값으로부터 다음과 같이 생성합니다: return std:: error_condition ( static_cast < int > ( e ) , std:: iostream_category ( ) ) .

목차

매개변수

e - 오류 코드 번호

반환값

std::error_condition 타입의 값으로, e 에서 오류 카테고리 "iostream" 와 연관된 오류 코드 번호를 보유합니다.

예제

#include <iostream>
#include <system_error>
int main()
{
    std::error_condition ec = std::make_error_condition(std::io_errc::stream);
    std::cout << "error condition for io_errc::stream has value " << ec.value()
              << "\nand message \"" << ec.message() << "\"\n";
}

출력:

error condition for io_errc::stream has value 1
and message "unspecified iostream_category error"

결함 보고서

다음의 동작 변경 결함 보고서들은 이전에 발표된 C++ 표준에 소급 적용되었습니다.

DR 적용 대상 게시된 동작 올바른 동작
LWG 2087 C++11 make_error_condition(io_errc) 가 선언되지 않음 noexcept 선언됨 noexcept

참고 항목

이식 가능한 오류 코드를 보유함
(클래스)
(C++11)
IO 스트림 오류 코드들
(열거형)