std::istreambuf_iterator 연산자

std::istreambuf_iterator 연산자 (operator== 등)

std::istreambuf_iterator가 둘 다 유효하거나 둘 다 유효하지 않은지 확인하는 연산자들이에요.

출처: cppreference

본문

<iterator> 헤더에 정의돼 있어요.

// (1)
template< class CharT, class Traits >
bool operator==( const std::istreambuf_iterator<CharT,Traits>& lhs,
                 const std::istreambuf_iterator<CharT,Traits>& rhs );

// (2) C++20까지
template< class CharT, class Traits >
bool operator!=( const std::istreambuf_iterator<CharT,Traits>& lhs,
                 const std::istreambuf_iterator<CharT,Traits>& rhs );

// (3) C++20부터
friend bool operator==( const istreambuf_iterator& lhs,
                        std::default_sentinel_t );

lhsrhs가 사용하는 스트림 버퍼 객체와 무관하게, 둘 다 유효하거나 둘 다 유효하지 않은지 확인해요.

    1. lhs.equal(rhs)와 동등해요.
    1. !lhs.equal(rhs)와 동등해요(C++20까지).
    1. lhs가 유효하지 않은지 확인해요. lhs.equal(istreambuf_iterator{})와 동등해요(C++20부터). 이 함수는 일반적인 조회로는 보이지 않고 ADL로만 찾을 수 있어요.

반환값

    1. lhsrhs가 모두 end-of-stream이거나 모두 그렇지 않으면 true.
    1. 1의 부정.
    1. lhs가 end-of-stream이면 true.

더 알아보기 (Learn more)

cppreference