名稱空間
變體
操作

std::sub_match<BidirIt>::compare

來自 cppreference.com
< cpp‎ | regex‎ | sub_match
 
 
 
正則表示式庫
(C++11)
演算法
迭代器
異常
特性
常量
(C++11)
正則表示式語法
 
std::sub_match
成員函式
sub_match::compare
非成員函式
(直到 C++20)(直到 C++20)(直到 C++20)(直到 C++20)(直到 C++20)(C++20)
 
int compare( const sub_match& m ) const;
(1) (C++11 起)
int compare( const string_type& s ) const;
(2) (C++11 起)
int compare( const value_type* c ) const;
(3) (C++11 起)
1) 透過比較其底層字元序列直接比較兩個 sub_match。等價於 str().compare(m.str())
2)sub_matchstd::basic_string 進行比較。等價於 str().compare(s)
3)sub_match 與指向 s 的底層字元型別的空終止序列進行比較。等價於 str().compare(c)

目錄

[編輯] 引數

m - 對另一個 sub_match 的引用
s - 對要比較的字串的引用
c - 指向要比較的底層 value_type 的空終止字元序列的指標

[編輯] 返回值

如果此 sub_match 小於 另一個字元序列,則返回小於零的值;如果兩個底層字元序列相等,則返回零;如果此 sub_match 大於 另一個字元序列,則返回大於零的值。

[編輯] 注意

此函式很少被應用程式程式碼直接使用。通常會使用非成員比較運算子之一。

[編輯] 示例

[編輯] 參閱

比較兩個字串
(std::basic_string<CharT,Traits,Allocator> 的公共成員函式) [編輯]
轉換為底層字串型別
(公共成員函式) [編輯]
(在 C++20 中移除)(在 C++20 中移除)(在 C++20 中移除)(在 C++20 中移除)(在 C++20 中移除)(C++20)
sub_match 與另一個 sub_match、字串或字元進行比較
(函式模板) [編輯]