std::sub_match::compare

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_matchs 所指向的底层字符类型的空终止序列。等价于 str().compare(c)

应用代码很少直接使用此函数。它们替而使用非成员比较运算符之一。

目录

参数

m - 到另一 sub_match 的引用
s - 到要比较的字符串的引用
c - 指向要比较的底层 value_type 的空终止序列的指针

返回值

若此 sub_match 小于另一字符序列则小于零的值,若二个底层字符序列相等则为零,若此 sub_match 大于另一字符序列则为大于零的值。

示例

参阅

比较二个字符串
(std::basic_string 的公开成员函数)
转换为底层字符串类型
(公开成员函数)
比较两个 sub_match 对象
(函数模板)

版本历史

  • (当前 | 先前 2017年10月16日 (一) 09:05Fruderica讨论 | 贡献. . (1,438字节) (-1,231). . (撤销)
  • 当前 | 先前 2014年10月26日 (日) 18:07P12bot讨论 | 贡献 . . (2,669字节) (0). . (Fix some translations) (撤销)
  • 当前 | 先前 2013年7月2日 (二) 11:16P12bot讨论 | 贡献 . . (2,669字节) (-165). . (Use {{lc}}. Update links. Various fixes.) (撤销)
  • 当前 | 先前 2012年11月2日 (五) 11:23P12bot讨论 | 贡献 . . (2,834字节) (+281). . (r2.7.3) (机器人添加:de, en, es, fr, it, ja, pt, ru) (撤销)
  • 当前 | 先前 2012年10月27日 (六) 12:11P12讨论 | 贡献 . . (2,553字节) (0). . (1个修订: Translate from the English version) (撤销)
  • 当前 | 先前 2012年10月26日 (五) 06:00TranslationBot讨论 | 贡献. . (2,553字节) (-71). . (Translated from the English version using Google Translate) (撤销)
  • 当前 | 先前 2012年10月25日 (四) 15:33P12讨论 | 贡献 . . (2,624字节) (0). . (1个修订: Translate from the English version) (撤销)
  • 当前 | 先前) 2012年10月25日 (四) 12:00TranslationBot讨论 | 贡献. . (2,624字节) (+2,624). . (Translated from the English version using Google Translate)