Namespaces
Variants

operator==,!=,<,<=,>,>=,<=> (std::sub_match)

From cppreference.net
Regular expressions library
Classes
(C++11)
Algorithms
Iterators
Exceptions
Traits
Constants
(C++11)
Regex Grammar
std::sub_match
Member functions
Non-member functions
operator== operator!= operator<< operator<= operator> operator>= operator<=>
(until C++20) (until C++20) (until C++20) (until C++20) (until C++20) (C++20)
**변경된 부분:** - `(since C++11)` → `(C++11 이후)` - `(until C++20)` → `(C++20 이전까지)` **참고사항:** - HTML 태그와 속성은 그대로 유지 - ` `, `
`, `` 태그 내부 텍스트가 없으므로 해당 사항 없음
- C++ 관련 용어(template, class, bool, const, operator, std::sub_match 등)는 번역하지 않음
- 전문성과 정확성을 유지하며 번역
헤더에 정의됨 <regex>
직접 비교
template < class BidirIt >

bool operator == ( const std:: sub_match < BidirIt > & lhs,

const std:: sub_match < BidirIt > & rhs ) ;
(1) (C++11 이후)
template < class BidirIt >

bool operator ! = ( const std:: sub_match < BidirIt > & lhs,

const std:: sub_match < BidirIt > & rhs ) ;
(2) (C++11부터)
(C++20까지)
template < class BidirIt >

bool operator < ( const std:: sub_match < BidirIt > & lhs,

const std:: sub_match < BidirIt > & rhs ) ;
(3) (C++11 이후)
(C++20 이전)
template < class BidirIt >

bool operator <= ( const std:: sub_match < BidirIt > & lhs,

const std:: sub_match < BidirIt > & rhs ) ;
(4) (C++11 이후)
(C++20 이전)
template < class BidirIt >

bool operator > ( const std:: sub_match < BidirIt > & lhs,

const std:: sub_match < BidirIt > & rhs ) ;
(5) (C++11부터)
(C++20까지)
template < class BidirIt >

bool operator >= ( const std:: sub_match < BidirIt > & lhs,

const std:: sub_match < BidirIt > & rhs ) ;
(6) (C++11부터)
(C++20까지)
template < class BidirIt >

auto operator <=> ( const std:: sub_match < BidirIt > & lhs,

const std:: sub_match < BidirIt > & rhs ) ;
(7) (C++20부터)
std::basic_string 과 비교하기
template < class BidirIt, class Traits, class Alloc >

bool operator == ( const std:: sub_match < BidirIt > & lhs,
const std:: basic_string < /*value-type-of*/ < BidirIt > ,

Traits, Alloc > & str ) ;
(8) (C++11 이후)
template < class BidirIt, class Traits, class Alloc >

bool operator ! = ( const std:: sub_match < BidirIt > & lhs,
const std:: basic_string < /*value-type-of*/ < BidirIt > ,

Traits, Alloc > & str ) ;
(9) (C++11부터)
(C++20 이전까지)
template < class BidirIt, class Traits, class Alloc >

bool operator < ( const std:: sub_match < BidirIt > & lhs,
const std:: basic_string < /*value-type-of*/ < BidirIt > ,

Traits, Alloc > & str ) ;
(10) (C++11 이후)
(C++20 이전까지)
template < class BidirIt, class Traits, class Alloc >

bool operator <= ( const std:: sub_match < BidirIt > & lhs,
const std:: basic_string < /*value-type-of*/ < BidirIt > ,

Traits, Alloc > & str ) ;
(11) (C++11 이후)
(C++20 이전까지)
template < class BidirIt, class Traits, class Alloc >

bool operator > ( const std:: sub_match < BidirIt > & lhs,
const std:: basic_string < /*value-type-of*/ < BidirIt > ,

Traits, Alloc > & str ) ;
(12) (C++11 이후)
(C++20 이전까지)
template < class BidirIt, class Traits, class Alloc >

bool operator >= ( const std:: sub_match < BidirIt > & lhs,
const std:: basic_string < /*value-type-of*/ < BidirIt > ,

Traits, Alloc > & str ) ;
(13) (C++11 이후)
(C++20 이전)
template < class BidirIt, class Traits, class Alloc >

auto operator <=> ( const std:: sub_match < BidirIt > & lhs,
const std:: basic_string < /*value-type-of*/ < BidirIt > ,

Traits, Alloc > & str ) ;
(14) (C++20 이후)
template < class BidirIt, class Traits, class Alloc >

bool operator == ( const std:: basic_string < /*value-type-of*/ < BidirIt > ,
Traits, Alloc > & str,

const std:: sub_match < BidirIt > & rhs ) ;
(15) (C++11 이후)
(C++20 이전)
template < class BidirIt, class Traits, class Alloc >

bool operator ! = ( const std:: basic_string < /*value-type-of*/ < BidirIt > ,
Traits, Alloc > & str,

const std:: sub_match < BidirIt > & rhs ) ;
(16) (C++11부터)
(C++20까지)
template < class BidirIt, class Traits, class Alloc >

bool operator < ( const std:: basic_string < /*value-type-of*/ < BidirIt > ,
Traits, Alloc > & str,

const std:: sub_match < BidirIt > & rhs ) ;
(17) (C++11 이후)
(C++20 이전까지)
template < class BidirIt, class Traits, class Alloc >

bool operator <= ( const std:: basic_string < /*value-type-of*/ < BidirIt > ,
Traits, Alloc > & str,

const std:: sub_match < BidirIt > & rhs ) ;
(18) (C++11 이후)
(C++20 이전까지)
template < class BidirIt, class Traits, class Alloc >

bool operator > ( const std:: basic_string < /*value-type-of*/ < BidirIt > ,
Traits, Alloc > & str,

const std:: sub_match < BidirIt > & rhs ) ;
(19) (C++11 이후)
(C++20 이전까지)
template < class BidirIt, class Traits, class Alloc >

bool operator >= ( const std:: basic_string < /*value-type-of*/ < BidirIt > ,
Traits, Alloc > & str,

const std:: sub_match < BidirIt > & rhs ) ;
(20) (C++11 이후)
(C++20 이전)
C 스타일 문자열과 비교하기
template < class BidirIt >

bool operator == ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > * s ) ;
(21) (C++11 이후)
template < class BidirIt >

bool operator ! = ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > * s ) ;
(22) (C++11부터)
(C++20까지)
template < class BidirIt >

bool operator < ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > * s ) ;
(23) (C++11부터)
(C++20까지)
template < class BidirIt >

bool operator <= ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > * s ) ;
(24) (C++11부터)
(C++20까지)
template < class BidirIt >

bool operator > ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > * s ) ;
(25) (C++11부터)
(C++20까지)
template < class BidirIt >

bool operator >= ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > * s ) ;
(26) (C++11 이후)
(C++20 이전)
template < class BidirIt >

auto operator <=> ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > * s ) ;
(27) (C++20 이후)
template < class BidirIt >

bool operator == ( const /*value-type-of*/ < BidirIt > * s,

const std:: sub_match < BidirIt > & rhs ) ;
(28) (C++11 이후)
(C++20 이전)
template < class BidirIt >

bool operator ! = ( const /*value-type-of*/ < BidirIt > * s,

const std:: sub_match < BidirIt > & rhs ) ;
(29) (C++11 이후)
(C++20 이전까지)
template < class BidirIt >

bool operator < ( const /*value-type-of*/ < BidirIt > * s,

const std:: sub_match < BidirIt > & rhs ) ;
(30) (C++11 이후)
(C++20 이전까지)
template < class BidirIt >

bool operator <= ( const /*value-type-of*/ < BidirIt > * s,

const std:: sub_match < BidirIt > & rhs ) ;
(31) (C++11 이후)
(C++20 이전)
template < class BidirIt >

bool operator > ( const /*value-type-of*/ < BidirIt > * s,

const std:: sub_match < BidirIt > & rhs ) ;
(32) (C++11 이후)
(C++20 이전)
template < class BidirIt >

bool operator >= ( const /*value-type-of*/ < BidirIt > * s,

const std:: sub_match < BidirIt > & rhs ) ;
(33) (C++11 이후)
(C++20 이전까지)
단일 문자와 비교하기
template < class BidirIt >

bool operator == ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > & ch ) ;
(34) (C++11부터)
template < class BidirIt >

bool operator ! = ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > & ch ) ;
(35) (C++11 이후)
(C++20 이전)
template < class BidirIt >

bool operator < ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > & ch ) ;
(36) (C++11 이후)
(C++20 이전)
template < class BidirIt >

bool operator <= ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > & ch ) ;
(37) (C++11부터)
(C++20까지)
template < class BidirIt >

bool operator > ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > & ch ) ;
(38) (C++11 이후)
(C++20 이전)
template < class BidirIt >

bool operator >= ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > & ch ) ;
(39) (C++11 이후)
(C++20 이전)
template < class BidirIt >

auto operator <=> ( const std:: sub_match < BidirIt > & lhs,

const /*value-type-of*/ < BidirIt > & ch ) ;
(40) (C++20부터)
template < class BidirIt >

bool operator == ( const /*value-type-of*/ < BidirIt > & ch,

const std:: sub_match < BidirIt > & rhs ) ;
(41) (C++11 이후)
(C++20 이전)
template < class BidirIt >

bool operator ! = ( const /*value-type-of*/ < BidirIt > & ch,

const std:: sub_match < BidirIt > & rhs ) ;
(42) (C++11 이후)
(C++20 이전)
template < class BidirIt >

bool operator < ( const /*value-type-of*/ < BidirIt > & ch,

const std:: sub_match < BidirIt > & rhs ) ;
(43) (C++11 이후)
(C++20 이전까지)
template < class BidirIt >

bool operator <= ( const /*value-type-of*/ < BidirIt > & ch,

const std:: sub_match < BidirIt > & rhs ) ;
(44) (C++11 이후)
(C++20 이전까지)
template < class BidirIt >

bool operator > ( const /*value-type-of*/ < BidirIt > & ch,

const std:: sub_match < BidirIt > & rhs ) ;
(45) (C++11 이후)
(C++20 이전까지)
template < class BidirIt >

bool operator >= ( const /*value-type-of*/ < BidirIt > & ch,

const std:: sub_match < BidirIt > & rhs ) ;
(46) (C++11 이후)
(C++20 이전까지)
헬퍼 타입 별칭
template < class BidirIt >

using /*value-type-of*/ =

typename std:: iterator_traits < BidirIt > :: value_type ;
(47) ( exposition only* )
template < class BidirIt >

using /*cat-type-of*/ =
std:: compare_three_way_result_t

< std:: basic_string < /*value-type-of*/ < BidirIt >>> ;
(48) (C++20부터)
( 설명 전용* )

sub_match 를 다른 sub_match 와 비교하거나, std::string , C 스타일 문자열 또는 단일 문자와 비교합니다.

1-7) sub_match 를 직접 비교합니다.
8-20) sub_match std::basic_string 과 비교합니다.
21-33) sub_match 를 C 스타일 문자열과 비교합니다.
34-46) sub_match 를 단일 문자와 비교합니다.

< , <= , > , >= , 그리고 != 연산자들은 각각 operator <=> operator == 로부터 합성됩니다 .

(C++20부터)
47) value-type-of  < BidirIt > BidirIt 값 타입 입니다.
48) cat-type-of  < BidirIt > std:: sub_match < BidirIt > 의 삼방 비교 결과 타입입니다.

목차

매개변수

lhs, rhs - 비교할 sub_match
str - 비교할 std::basic_string
s - 비교할 C 스타일 문자열 포인터
ch - 비교할 문자

반환값

다음 값들을 target 으로 설정합니다:

1-7) rhs
8-20) typename std:: sub_match < BidirIt > :: string_type ( str. data ( ) , str. size ( ) )
21-33) s
34-46) typename std:: sub_match < BidirIt > :: string_type ( 1 , ch )

반환 값은 다음과 같이 정의됩니다:

연산자 반환 값
오버로드 (1-14,21-27,34-40)
( lhs 매개변수를 갖는 오버로드)
오버로드 (15-20,28-33,41-46)
( lhs 매개변수가 없는 오버로드)
== lhs. compare ( target ) == 0 rhs. compare ( target ) == 0
!= lhs. compare ( target ) ! = 0 rhs. compare ( target ) ! = 0
< lhs. compare ( target ) < 0 rhs. compare ( target ) > 0
<= lhs. compare ( target ) <= 0 rhs. compare ( target ) >= 0
> lhs. compare ( target ) > 0 rhs. compare ( target ) < 0
>= lhs. compare ( target ) >= 0 rhs. compare ( target ) <= 0
<=> static_cast < cat-type-of  < BidirIt >>
( lhs. compare ( target ) <=> 0 )
해당 없음

참고 사항

operator <=> 의 반환 타입은 비교 범주 타입임이 보장됩니다. 만약 value-type-of  < BidirIt > char , wchar_t , char8_t , char16_t , 또는 char32_t 인 경우, operator<=> 의 반환 타입은 std::strong_ordering 입니다.

예제

결함 보고서

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

DR 적용 대상 게시된 동작 올바른 동작
LWG 2217 C++11 std::string 과의 비교에서
compare() 의 인자가 str. c_str ( ) 였음
인자는
string_type ( str. data ( ) , str. size ( ) ) )

참고 항목

매칭된 부분 시퀀스(있는 경우)를 비교합니다
(public member function)