operator==,!=,<,<=,>,>=,<=>(std::sub_match)
在标头 <regex> 定义
|
||
直接比较 |
||
template< class BidirIt > bool operator== ( const std::sub_match<BidirIt>& lhs, |
(1) | (C++11 起) |
template< class BidirIt > bool operator!= ( const std::sub_match<BidirIt>& lhs, |
(2) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator< ( const std::sub_match<BidirIt>& lhs, |
(3) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator<= ( const std::sub_match<BidirIt>& lhs, |
(4) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator> ( const std::sub_match<BidirIt>& lhs, |
(5) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator>= ( const std::sub_match<BidirIt>& lhs, |
(6) | (C++11 起) (C++20 前) |
template< class BidirIt > auto operator<=>( const std::sub_match<BidirIt>& lhs, |
(7) | (C++20 起) |
与 std::basic_string 进行比较 |
||
template< class BidirIt, class Traits, class Alloc > bool operator== ( const std::sub_match<BidirIt>& lhs, |
(8) | (C++11 起) |
template< class BidirIt, class Traits, class Alloc > bool operator!= ( const std::sub_match<BidirIt>& lhs, |
(9) | (C++11 起) (C++20 前) |
template< class BidirIt, class Traits, class Alloc > bool operator< ( const std::sub_match<BidirIt>& lhs, |
(10) | (C++11 起) (C++20 前) |
template< class BidirIt, class Traits, class Alloc > bool operator<= ( const std::sub_match<BidirIt>& lhs, |
(11) | (C++11 起) (C++20 前) |
template< class BidirIt, class Traits, class Alloc > bool operator> ( const std::sub_match<BidirIt>& lhs, |
(12) | (C++11 起) (C++20 前) |
template< class BidirIt, class Traits, class Alloc > bool operator>= ( const std::sub_match<BidirIt>& lhs, |
(13) | (C++11 起) (C++20 前) |
template< class BidirIt, class Traits, class Alloc > auto operator<=>( const std::sub_match<BidirIt>& lhs, |
(14) | (C++20 起) |
template< class BidirIt, class Traits, class Alloc > bool operator== ( const std::basic_string</*value-type-of*/<BidirIt>, |
(15) | (C++11 起) (C++20 前) |
template< class BidirIt, class Traits, class Alloc > bool operator!= ( const std::basic_string</*value-type-of*/<BidirIt>, |
(16) | (C++11 起) (C++20 前) |
template< class BidirIt, class Traits, class Alloc > bool operator< ( const std::basic_string</*value-type-of*/<BidirIt>, |
(17) | (C++11 起) (C++20 前) |
template< class BidirIt, class Traits, class Alloc > bool operator<= ( const std::basic_string</*value-type-of*/<BidirIt>, |
(18) | (C++11 起) (C++20 前) |
template< class BidirIt, class Traits, class Alloc > bool operator> ( const std::basic_string</*value-type-of*/<BidirIt>, |
(19) | (C++11 起) (C++20 前) |
template< class BidirIt, class Traits, class Alloc > bool operator>= ( const std::basic_string</*value-type-of*/<BidirIt>, |
(20) | (C++11 起) (C++20 前) |
与 C 风格字符串进行比较 |
||
template< class BidirIt > bool operator== ( const std::sub_match<BidirIt>& lhs, |
(21) | (C++11 起) |
template< class BidirIt > bool operator!= ( const std::sub_match<BidirIt>& lhs, |
(22) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator< ( const std::sub_match<BidirIt>& lhs, |
(23) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator<= ( const std::sub_match<BidirIt>& lhs, |
(24) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator> ( const std::sub_match<BidirIt>& lhs, |
(25) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator>= ( const std::sub_match<BidirIt>& lhs, |
(26) | (C++11 起) (C++20 前) |
template< class BidirIt > auto operator<=>( const std::sub_match<BidirIt>& lhs, |
(27) | (C++20 起) |
template< class BidirIt > bool operator== ( const /*value-type-of*/<BidirIt>* s, |
(28) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator!= ( const /*value-type-of*/<BidirIt>* s, |
(29) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator< ( const /*value-type-of*/<BidirIt>* s, |
(30) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator<= ( const /*value-type-of*/<BidirIt>* s, |
(31) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator> ( const /*value-type-of*/<BidirIt>* s, |
(32) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator>= ( const /*value-type-of*/<BidirIt>* s, |
(33) | (C++11 起) (C++20 前) |
与单个字符进行比较 |
||
template< class BidirIt > bool operator== ( const std::sub_match<BidirIt>& lhs, |
(34) | (C++11 起) |
template< class BidirIt > bool operator!= ( const std::sub_match<BidirIt>& lhs, |
(35) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator< ( const std::sub_match<BidirIt>& lhs, |
(36) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator<= ( const std::sub_match<BidirIt>& lhs, |
(37) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator> ( const std::sub_match<BidirIt>& lhs, |
(38) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator>= ( const std::sub_match<BidirIt>& lhs, |
(39) | (C++11 起) (C++20 前) |
template< class BidirIt > auto operator<=>( const std::sub_match<BidirIt>& lhs, |
(40) | (C++20 起) |
template< class BidirIt > bool operator== ( const /*value-type-of*/<BidirIt>& ch, |
(41) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator!= ( const /*value-type-of*/<BidirIt>& ch, |
(42) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator< ( const /*value-type-of*/<BidirIt>& ch, |
(43) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator<= ( const /*value-type-of*/<BidirIt>& ch, |
(44) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator> ( const /*value-type-of*/<BidirIt>& ch, |
(45) | (C++11 起) (C++20 前) |
template< class BidirIt > bool operator>= ( const /*value-type-of*/<BidirIt>& ch, |
(46) | (C++11 起) (C++20 前) |
辅助类型别名 |
||
template< class BidirIt > using /*value-type-of*/ = |
(47) | (仅用于阐述*) |
template< class BidirIt > using /*cat-type-of*/ = |
(48) | (C++20 起) (仅用于阐述*) |
将 sub_match
与另一 sub_match
、std::string、C 风格字符串或单个字符进行比较。
|
(C++20 起) |
目录 |
[编辑] 参数
lhs, rhs, sm | - | 要比较的 sub_match
|
str | - | 要比较的 std::basic_string |
s | - | 指向要比较的 C 风格字符串的指针 |
ch | - | 要比较的字符 |
[编辑] 返回值
设 target 为以下值:
返回值定义如下
运算符 | 返回值 | |
---|---|---|
重载 (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++ 标准。
缺陷报告 | 应用于 | 出版时的行为 | 正确行为 |
---|---|---|---|
LWG 2217 | C++11 | 对于与 std::string 进行的比较,compare() 的实参是 str.c_str()
|
实参是 string_type(str.data(), str.size())) |
[编辑] 参阅
若存在则比较匹配的子序列 (公开成员函数) |