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)
**Änderungen:** - "(since C++20)" wurde zu "(seit C++20)" übersetzt - Alle HTML-Tags, Attribute und Code-Blöcke wurden unverändert beibehalten - C++-spezifische Begriffe (template, class, auto, operator, const, std::sub_match, etc.) wurden nicht übersetzt - Die numerische Referenz (40) bleibt unverändert (Anmerkung: Der bereitgestellte HTML-Code enthält keinen übersetzbaren Text, da alle Tags leer sind. Die Struktur wurde gemäß den Anforderungen unverändert beibehalten.)
Definiert in Header <regex>
Direkter Vergleich
template < class BidirIt >

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

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

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

const std:: sub_match < BidirIt > & rhs ) ;
(2) (seit C++11)
(bis C++20)
template < class BidirIt >

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

const std:: sub_match < BidirIt > & rhs ) ;
(3) (seit C++11)
(bis C++20)
template < class BidirIt >

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

const std:: sub_match < BidirIt > & rhs ) ;
(4) (seit C++11)
(bis C++20)
template < class BidirIt >

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

const std:: sub_match < BidirIt > & rhs ) ;
(5) (seit C++11)
(bis C++20)
template < class BidirIt >

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

const std:: sub_match < BidirIt > & rhs ) ;
(6) (seit C++11)
(bis C++20)
template < class BidirIt >

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

const std:: sub_match < BidirIt > & rhs ) ;
(7) (seit C++20)
Vergleich mit einem 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) (seit 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) (seit C++11)
(bis 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) (seit C++11)
(bis 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) (seit C++11)
(bis 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) (seit C++11)
(bis 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) (seit C++11)
(bis 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) (seit 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) (seit C++11)
(bis 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) (seit C++11)
(bis 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) (seit C++11)
(bis 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) (seit C++11)
(bis 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) (seit C++11)
(bis C++20)
template < class BidirIt, class Traits, class Alloc >

bool operator >= ( const std:: basic_string < /*Werttyp-von*/ < BidirIt > ,
Traits, Alloc > & str,

const std:: sub_match < BidirIt > & rhs ) ;
(20) (seit C++11)
(bis C++20)
Vergleich mit einem C-String
template < class BidirIt >

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

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

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

const /*value-type-of*/ < BidirIt > * s ) ;
(22) (seit C++11)
(bis C++20)
template < class BidirIt >

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

const /*value-type-of*/ < BidirIt > * s ) ;
(23) (seit C++11)
(bis C++20)
template < class BidirIt >

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

const /*value-type-of*/ < BidirIt > * s ) ;
(24) (seit C++11)
(bis C++20)
template < class BidirIt >

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

const /*value-type-of*/ < BidirIt > * s ) ;
(25) (seit C++11)
(bis C++20)
template < class BidirIt >

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

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

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

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

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

const std:: sub_match < BidirIt > & rhs ) ;
(28) (seit C++11)
(bis C++20)
template < class BidirIt >

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

const std:: sub_match < BidirIt > & rhs ) ;
(29) (seit C++11)
(bis C++20)
template < class BidirIt >

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

const std:: sub_match < BidirIt > & rhs ) ;
(30) (seit C++11)
(bis C++20)
template < class BidirIt >

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

const std:: sub_match < BidirIt > & rhs ) ;
(31) (seit C++11)
(bis C++20)
template < class BidirIt >

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

const std:: sub_match < BidirIt > & rhs ) ;
(32) (seit C++11)
(bis C++20)
template < class BidirIt >

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

const std:: sub_match < BidirIt > & rhs ) ;
(33) (seit C++11)
(bis C++20)
Vergleich mit einem einzelnen Zeichen
template < class BidirIt >

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

const /*Wertetyp-von*/ < BidirIt > & ch ) ;
(34) (seit C++11)
template < class BidirIt >

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

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

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

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

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

const /*value-type-of*/ < BidirIt > & ch ) ;
(37) (seit C++11)
(bis C++20)
template < class BidirIt >

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

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

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

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

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

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

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

const std:: sub_match < BidirIt > & rhs ) ;
(41) (seit C++11)
(bis C++20)
template < class BidirIt >

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

const std:: sub_match < BidirIt > & rhs ) ;
(42) (seit C++11)
(bis C++20)
template < class BidirIt >

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

const std:: sub_match < BidirIt > & rhs ) ;
(43) (seit C++11)
(bis C++20)
template < class BidirIt >

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

const std:: sub_match < BidirIt > & rhs ) ;
(44) (seit C++11)
(bis C++20)
template < class BidirIt >

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

const std:: sub_match < BidirIt > & rhs ) ;
(45) (seit C++11)
(bis C++20)
template < class BidirIt >

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

const std:: sub_match < BidirIt > & rhs ) ;
(46) (seit C++11)
(bis C++20)
Hilfstyp-Aliase
template < class BidirIt >

using /*value-type-of*/ =

typename std:: iterator_traits < BidirIt > :: value_type ;
(47) ( nur zur Darstellung* )
template < class BidirIt >

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

< std:: basic_string < /*value-type-of*/ < BidirIt >>> ;
(48) (seit C++20)
( Nur zur Darstellung* )

Vergleicht einen sub_match mit einem anderen sub_match , einem std::string , einem C-String oder einem einzelnen Zeichen.

1-7) Vergleicht zwei sub_match direkt.
8-20) Vergleicht ein sub_match mit einem std::basic_string .
21-33) Vergleicht einen sub_match mit einem C-String.
34-46) Vergleicht einen sub_match mit einem einzelnen Zeichen.

Die Operatoren < , <= , > , >= und != werden synthetisiert aus operator <=> beziehungsweise operator == .

(seit C++20)
47) value-type-of  < BidirIt > ist der Werttyp von BidirIt .
48) cat-type-of  < BidirIt > ist der Ergebnistyp des Drei-Wege-Vergleichs von std:: sub_match < BidirIt > .

Inhaltsverzeichnis

Parameter

lhs, rhs - ein sub_match zum Vergleichen
str - eine std::basic_string zum Vergleichen
s - ein Zeiger auf einen C-String zum Vergleichen
ch - ein Zeichen zum Vergleichen

Rückgabewert

Sei target die folgenden Werte:

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 )

Die Rückgabewerte sind wie folgt definiert:

Operator Rückgabewert
Überladungen (1-14,21-27,34-40)
(Überladungen mit Parameter lhs )
Überladungen (15-20,28-33,41-46)
(Überladungen ohne Parameter 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 )
N/V

Hinweise

Der Rückgabetyp von operator <=> ist garantiert ein Vergleichskategorietyp. Wenn value-type-of  < BidirIt > char , wchar_t , char8_t , char16_t oder char32_t ist, dann ist der Rückgabetyp von operator<=> std::strong_ordering .

Beispiel

Fehlerberichte

Die folgenden verhaltensändernden Fehlerberichte wurden rückwirkend auf zuvor veröffentlichte C++-Standards angewendet.

DR Angewendet auf Verhalten wie veröffentlicht Korrektes Verhalten
LWG 2217 C++11 für Vergleiche mit std::string war das
Argument von compare() str. c_str ( )
das Argument ist
string_type ( str. data ( ) , str. size ( ) ) )

Siehe auch

vergleicht übereinstimmende Teilsequenz (falls vorhanden)
(öffentliche Elementfunktion)