다음을 통해 공유


<system_error> 연산자

operator==

연산자의 좌변에 있는 개체가 우변에 있는 개체와 같은지 테스트합니다.

bool operator==(const error_code& left,
    const error_condition& right);

bool operator==(const error_condition& left,
    const error_code& right);

bool operator==(const error_condition& left,
    const error_condition& right);

매개 변수

left
같음을 테스트할 개체입니다.

right
같음을 테스트할 개체입니다.

Return Value

true 개체가 같으면 이고, false 개체가 같지 않으면 입니다.

설명

함수는 left.category() == right.category() && left.value() == right.value()를 반환합니다.

operator!=

연산자의 좌변에 있는 개체가 우변에 있는 개체와 같지 않은지 테스트합니다.

bool operator!=(const error_code& left, const error_condition& right);
bool operator!=(const error_condition& left, const error_code& right);
bool operator!=(const error_code& left, const error_code& right);
bool operator!=(const error_condition& left, const error_condition& right);

매개 변수

left
같지 않음을 테스트할 개체입니다.

right
같지 않음을 테스트할 개체입니다.

Return Value

true 왼쪽 전달된 개체가 right; 그렇지 않으면 false.

설명

함수는 !(left == right)를 반환합니다.

operator<

개체가 비교를 위해 전달된 개체보다 작은지 여부를 테스트합니다.

template <class _Enum>
inline bool operator<(
    _Enum left,
    typename enable_if<is_error_code_enum<_Enum>::value,
    const error_code&>::type right);

template <class _Enum>
inline bool operator<(
    typename enable_if<is_error_code_enum<_Enum>::value,
    const error_code&>::type left, _Enum right);

template <class _Enum>
inline bool operator<(
    _Enum left,
    typename enable_if<is_error_condition_enum<_Enum>::value,
    const error_condition&>::type right);

template <class _Enum>
inline bool operator<(
    typename enable_if<is_error_condition_enum<_Enum>::value,
    const error_condition&>::type left, _Enum right);

매개 변수

left
비교할 개체입니다.

right
비교할 개체입니다.

Return Value

true left 전달된 개체가 right; 에 전달된 개체보다 작은 경우 그렇지 않으면 false.

설명

이 함수는 오류 순서를 테스트합니다.

operator<<

출력 스트림에 error_code 개체를 삽입합니다.

template <class charT, class traits>
basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& os, const error_code& ec);

매개 변수

os
대상 출력 스트림입니다.

ec
출력할 error_code 개체입니다.

Return Value

수정된 출력 스트림에 대한 참조입니다.

설명

이 연산자는 os << ec.category().name() << ':' << ec.value()동일한 작업을 수행합니다.

본보기

#include <iostream>
#include <system_error>

int main()
{
    std::error_code ec(1234, std::generic_category());
    std::cout << ec;
}
generic:1234