| Localization library | |||||||||||||||||||||||||
| Regular expressions library(C++11) | |||||||||||||||||||||||||
| Formatting library(C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
| Classes | ||||
(C++11) | ||||
(C++11) | ||||
(C++11) | ||||
| Algorithms | ||||
(C++11) | ||||
(C++11) | ||||
(C++11) | ||||
| Iterators | ||||
(C++11) | ||||
(C++11) | ||||
| Exceptions | ||||
(C++11) | ||||
| Traits | ||||
(C++11) | ||||
| Constants | ||||
(C++11) | ||||
(C++11) | ||||
(C++11) | ||||
| Regex Grammar | ||||
(C++11) |
| 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) | ||||
Defined in header <regex> | ||
Direct comparison | ||
template<class BidirIt> bool operator==(conststd::sub_match<BidirIt>& lhs, | (1) | (since C++11) |
template<class BidirIt> bool operator!=(conststd::sub_match<BidirIt>& lhs, | (2) | (since C++11) (until C++20) |
template<class BidirIt> bool operator< (conststd::sub_match<BidirIt>& lhs, | (3) | (since C++11) (until C++20) |
template<class BidirIt> bool operator<=(conststd::sub_match<BidirIt>& lhs, | (4) | (since C++11) (until C++20) |
template<class BidirIt> bool operator> (conststd::sub_match<BidirIt>& lhs, | (5) | (since C++11) (until C++20) |
template<class BidirIt> bool operator>=(conststd::sub_match<BidirIt>& lhs, | (6) | (since C++11) (until C++20) |
template<class BidirIt> auto operator<=>(conststd::sub_match<BidirIt>& lhs, | (7) | (since C++20) |
Comparing with astd::basic_string | ||
template<class BidirIt,class Traits,class Alloc> bool operator==(conststd::sub_match<BidirIt>& lhs, | (8) | (since C++11) |
template<class BidirIt,class Traits,class Alloc> bool operator!=(conststd::sub_match<BidirIt>& lhs, | (9) | (since C++11) (until C++20) |
template<class BidirIt,class Traits,class Alloc> bool operator< (conststd::sub_match<BidirIt>& lhs, | (10) | (since C++11) (until C++20) |
template<class BidirIt,class Traits,class Alloc> bool operator<=(conststd::sub_match<BidirIt>& lhs, | (11) | (since C++11) (until C++20) |
template<class BidirIt,class Traits,class Alloc> bool operator> (conststd::sub_match<BidirIt>& lhs, | (12) | (since C++11) (until C++20) |
template<class BidirIt,class Traits,class Alloc> bool operator>=(conststd::sub_match<BidirIt>& lhs, | (13) | (since C++11) (until C++20) |
template<class BidirIt,class Traits,class Alloc> auto operator<=>(conststd::sub_match<BidirIt>& lhs, | (14) | (since C++20) |
template<class BidirIt,class Traits,class Alloc> bool operator==(conststd::basic_string</*value-type-of*/<BidirIt>, | (15) | (since C++11) (until C++20) |
template<class BidirIt,class Traits,class Alloc> bool operator!=(conststd::basic_string</*value-type-of*/<BidirIt>, | (16) | (since C++11) (until C++20) |
template<class BidirIt,class Traits,class Alloc> bool operator< (conststd::basic_string</*value-type-of*/<BidirIt>, | (17) | (since C++11) (until C++20) |
template<class BidirIt,class Traits,class Alloc> bool operator<=(conststd::basic_string</*value-type-of*/<BidirIt>, | (18) | (since C++11) (until C++20) |
template<class BidirIt,class Traits,class Alloc> bool operator> (conststd::basic_string</*value-type-of*/<BidirIt>, | (19) | (since C++11) (until C++20) |
template<class BidirIt,class Traits,class Alloc> bool operator>=(conststd::basic_string</*value-type-of*/<BidirIt>, | (20) | (since C++11) (until C++20) |
Comparing with a C-style string | ||
template<class BidirIt> bool operator==(conststd::sub_match<BidirIt>& lhs, | (21) | (since C++11) |
template<class BidirIt> bool operator!=(conststd::sub_match<BidirIt>& lhs, | (22) | (since C++11) (until C++20) |
template<class BidirIt> bool operator< (conststd::sub_match<BidirIt>& lhs, | (23) | (since C++11) (until C++20) |
template<class BidirIt> bool operator<=(conststd::sub_match<BidirIt>& lhs, | (24) | (since C++11) (until C++20) |
template<class BidirIt> bool operator> (conststd::sub_match<BidirIt>& lhs, | (25) | (since C++11) (until C++20) |
template<class BidirIt> bool operator>=(conststd::sub_match<BidirIt>& lhs, | (26) | (since C++11) (until C++20) |
template<class BidirIt> auto operator<=>(conststd::sub_match<BidirIt>& lhs, | (27) | (since C++20) |
template<class BidirIt> bool operator==(const/*value-type-of*/<BidirIt>* s, | (28) | (since C++11) (until C++20) |
template<class BidirIt> bool operator!=(const/*value-type-of*/<BidirIt>* s, | (29) | (since C++11) (until C++20) |
template<class BidirIt> bool operator< (const/*value-type-of*/<BidirIt>* s, | (30) | (since C++11) (until C++20) |
template<class BidirIt> bool operator<=(const/*value-type-of*/<BidirIt>* s, | (31) | (since C++11) (until C++20) |
template<class BidirIt> bool operator> (const/*value-type-of*/<BidirIt>* s, | (32) | (since C++11) (until C++20) |
template<class BidirIt> bool operator>=(const/*value-type-of*/<BidirIt>* s, | (33) | (since C++11) (until C++20) |
Comparing with a single character | ||
template<class BidirIt> bool operator==(conststd::sub_match<BidirIt>& lhs, | (34) | (since C++11) |
template<class BidirIt> bool operator!=(conststd::sub_match<BidirIt>& lhs, | (35) | (since C++11) (until C++20) |
template<class BidirIt> bool operator< (conststd::sub_match<BidirIt>& lhs, | (36) | (since C++11) (until C++20) |
template<class BidirIt> bool operator<=(conststd::sub_match<BidirIt>& lhs, | (37) | (since C++11) (until C++20) |
template<class BidirIt> bool operator> (conststd::sub_match<BidirIt>& lhs, | (38) | (since C++11) (until C++20) |
template<class BidirIt> bool operator>=(conststd::sub_match<BidirIt>& lhs, | (39) | (since C++11) (until C++20) |
template<class BidirIt> auto operator<=>(conststd::sub_match<BidirIt>& lhs, | (40) | (since C++20) |
template<class BidirIt> bool operator==(const/*value-type-of*/<BidirIt>& ch, | (41) | (since C++11) (until C++20) |
template<class BidirIt> bool operator!=(const/*value-type-of*/<BidirIt>& ch, | (42) | (since C++11) (until C++20) |
template<class BidirIt> bool operator< (const/*value-type-of*/<BidirIt>& ch, | (43) | (since C++11) (until C++20) |
template<class BidirIt> bool operator<=(const/*value-type-of*/<BidirIt>& ch, | (44) | (since C++11) (until C++20) |
template<class BidirIt> bool operator> (const/*value-type-of*/<BidirIt>& ch, | (45) | (since C++11) (until C++20) |
template<class BidirIt> bool operator>=(const/*value-type-of*/<BidirIt>& ch, | (46) | (since C++11) (until C++20) |
Helper type aliases | ||
template<class BidirIt> using/*value-type-of*/= | (47) | (exposition only*) |
template<class BidirIt> using/*cat-type-of*/= | (48) | (since C++20) (exposition only*) |
Compares asub_match to anothersub_match, astd::string, a C-style string or a single character.
sub_match directly.sub_match with a C-style string.sub_match with a single character.The | (since C++20) |
Contents |
| lhs, rhs | - | asub_match to compare |
| str | - | astd::basic_string to compare |
| s | - | a pointer to a C-style string to compare |
| ch | - | a character to compare |
Lettarget be the following values:
The return values are defined as follows:
| Operator | Return value | |
|---|---|---|
| Overloads(1-14,21-27,34-40) (overloads with parameterlhs) | Overloads(15-20,28-33,41-46) (overloads without parameterlhs) | |
== | 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/A |
The return type ofoperator<=> is guaranteed to be a comparison category type. Ifvalue-type-of <BidirIt> ischar,wchar_t,char8_t,char16_t, orchar32_t, the return type ofoperator<=> isstd::strong_ordering.
| This section is incomplete Reason: no example |
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 2217 | C++11 | for comparisons withstd::string, the argument of compare() wasstr.c_str() | the argument is string_type(str.data(), str.size())) |
| compares matched subsequence (if any) (public member function)[edit] |