operator==,!=(std::match_results)
来自 cppreference.cn
< cpp | regex | match results
定义于头文件 <regex> |
||
template< class BidirIt, class Alloc > bool operator==( match_results<BidirIt,Alloc>& lhs, |
(1) | (since C++11) |
template< class BidirIt, class Alloc > bool operator!=( match_results<BidirIt,Alloc>& lhs, |
(2) | (since C++11) (until C++20) |
比较两个 match_results
对象。
两个 match_results
相等,如果以下条件成立:
- 两个对象都不是就绪状态,或者
- 两个 match_results 都是就绪状态,且以下条件成立:
- 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 是否相等。
2) 检查 lhs 和 rhs 是否不相等。
|
(since C++20) |
内容 |
[编辑] 参数
lhs, rhs | - | 要比较的 match results |
类型要求 | ||
-BidirIt 必须满足 LegacyBidirectionalIterator 的要求。 | ||
-Alloc 必须满足 Allocator 的要求。 |
[编辑] 返回值
1) 如果 lhs 和 rhs 相等,则返回 true,否则返回 false。
2) 如果 lhs 和 rhs 不相等,则返回 true,否则返回 false。
[编辑] 异常
可能抛出实现定义的异常。
[编辑] 示例
本节内容不完整 原因:没有示例 |