< cpp‎ | regex‎ | sub match
Revision as of 12:22, 2 November 2012 by P12bot (Talk | contribs)

Template:ddcl list begin <tr class="t-dcl ">

<td >
int compare( const sub_match& m ) const;

<td > (1) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
int compare( const string_type& s ) const;

<td > (2) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
int compare( const value_type* c ) const;

<td > (3) </td> <td > (since C++11) </td> </tr> Template:ddcl list end

1) Compares two sub_match directly by comparing their underlying character sequences. Equivalent to str().compare(m.str())

2) Compares a sub_match with a std::basic_string. This function is implemented as follows. Equivalent to str().compare(s)

3) Compares a sub_match with a null-terminated sequence of the underlying character type pointed to by s. Equivalent to str().compare(c)

This function is infrequently used directly by application code. Instead, one of the non-member comparison operators are used.



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

Return value

A value less than zero if this sub_match is less than the other character sequence, zero if the both underlyinging character sequences are equal, greater than zero if this sub_match is greater than the other character sequence.


See also

Template:cpp/string/basic string/dcl list compare