match_results_operator_cmp

match_results_operator_cmp (일치 결과 비교)

std::match_results 비교 연산자는 두 match_results 객체를 비교해요. C++11부터 사용할 수 있어요.

출처: cppreference

본문

<regex> 헤더에 정의되어 있고, 시그니처는 다음과 같아요.

template< class BidirIt, class Alloc >
bool operator==( match_results<BidirIt,Alloc>& lhs,
                 match_results<BidirIt,Alloc>& rhs );

(1) (since C++11)

template< class BidirIt, class Alloc >
bool operator!=( match_results<BidirIt,Alloc>& lhs,
                 match_results<BidirIt,Alloc>& rhs );

(2) (since C++11) (until C++20)

두 match_results 객체를 비교해요.

두 match_results는 다음 조건이 충족되면 같아요:

  • 두 객체 중 어느 것도 ready가 아니거나,

  • 둘 다 ready이고 다음 조건을 만족하거나:

    • lhs.empty()이고 rhs.empty(), 또는
    • !lhs.empty()이고 !rhs.empty()이며 다음 조건을 만족:
      • lhs.prefix() == rhs.prefix()
      • lhs.size() == rhs.size() && std::equal(lhs.begin(), lhs.end(), rhs.begin())
      • lhs.suffix() == rhs.suffix()
    1. lhs와 rhs가 같은지 검사해요.
    1. lhs와 rhs가 같지 않은지 검사해요.

!= 연산자는 operator==에서 합성돼요.

(C++20부터)

매개변수 (Parameters)

  • lhs, rhs — 비교할 일치 결과

타입 요구사항 (Type requirements)

  • BidirIt은 LegacyBidirectionalIterator 요구사항을 만족해야 해요.
  • Alloc은 Allocator 요구사항을 만족해야 해요.

반환값 (Return value)

    1. lhs와 rhs가 같으면 true, 그 외에는 false
    1. lhs와 rhs가 같지 않으면 true, 그 외에는 false

예외 (Exceptions)

구현 정의 예외를 던질 수 있어요.

더 알아보기 (Learn more)

cppreference