在线文档教程
C++
规律表达 | Regular expressions

std::sub_match::compare

性病::[医]匹配::比较

int compare( const sub_match& m ) const;(1)(since C++11)
int compare( const string_type& s ) const;(2)(since C++11)
int compare( const value_type* c ) const;(3)(since C++11)

1%29比较两sub_match直接通过比较它们的潜在字符序列。相当于str().compare(m.str())...

2%29比较asub_match带着std::basic_string相当于str().compare(s)...

3%29比较asub_match中指向的基础字符类型的空结束序列。s相当于str().compare(c)...

应用程序代码很少直接使用此函数。相反,使用非会员比较运算符之一。

参数

m-a pointer to another sub_match
s-a pointer to a string to compare to
c-a pointer to a null-terminated character sequence of the underlying value_type to compare to

返回值

值小于零,如果这个子[医]匹配再少点比其他字符序列,如果两个下面的字符序列相等,则为零,如果此子字符序列大于零。[医]匹配更大比其他字符序列。

另见

comparecompares two strings (public member function of std::basic_string)
stroperator string_typeconverts to the underlying string type (public member function)
operator==operator!=operator<operator<=operator>operator>=compares two sub_match objects (function template)

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/regex/sub[医]匹配/比较