operator==,!=(std::match_results)
來自 cppreference.com
< cpp | regex | match results
在標頭檔案 <regex> 中定義 |
||
template< class BidirIt, class Alloc > bool operator==( match_results<BidirIt,Alloc>& lhs, |
(1) | (C++11 起) |
template< class BidirIt, class Alloc > bool operator!=( match_results<BidirIt,Alloc>& lhs, |
(2) | (C++11 起) (C++20 前) |
比較兩個 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 是否不相等。
|
(C++20 起) |
目錄 |
[編輯] 引數
lhs, rhs | - | 要比較的匹配結果 |
型別要求 | ||
-BidirIt 必須滿足 LegacyBidirectionalIterator 的要求。 | ||
-Alloc 必須滿足 Allocator 的要求。 |
[編輯] 返回值
1) 如果 lhs 和 rhs 相等則為 true,否則為 false。
2) 如果 lhs 和 rhs 不相等則為 true,否則為 false。
[編輯] 異常
可能丟擲實現定義的異常。
[編輯] 示例
本節不完整 原因:無示例 |