Namespaces
Variants
Views
Actions

operator==,!=,<,<=,>,>=(std::basic_string)

From cppreference.com
< cpp‎ | string‎ | basic string
Revision as of 10:38, 19 March 2012 by P12 (Talk | contribs)

Template:cpp/string/basic string/sidebar Template:ddcl list begin <tr class="t-dcl ">

<td >
template< class T, class Alloc >
bool operator==( basic_string<T,Alloc>& lhs, basic_string<T,Alloc>& rhs );
</td>

<td > (1) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td >
template< class T, class Alloc >
bool operator!=( basic_string<T,Alloc>& lhs, basic_string<T,Alloc>& rhs );
</td>

<td > (2) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td >
template< class T, class Alloc >
bool operator<( basic_string<T,Alloc>& lhs, basic_string<T,Alloc>& rhs );
</td>

<td > (3) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td >
template< class T, class Alloc >
bool operator<=( basic_string<T,Alloc>& lhs, basic_string<T,Alloc>& rhs );
</td>

<td > (4) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td >
template< class T, class Alloc >
bool operator>( basic_string<T,Alloc>& lhs, basic_string<T,Alloc>& rhs );
</td>

<td > (5) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td >
template< class T, class Alloc >
bool operator>=( basic_string<T,Alloc>& lhs, basic_string<T,Alloc>& rhs );
</td>

<td > (6) </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end

Compares the contents of two strings.

1-2) Checks if the contents of lhs and rhs are equal, that is, Template:cpp and each character in lhs has equivalent character in rhs at the same position.

3-6) Compares the contents of lhs and rhs lexicographically. The comparison is performed by a function equivalent to Template:cpp.

Parameters

lhs, rhs - strings whose contents to compare

Return value

1) Template:cpp if the contents of the strings are equivalent, Template:cpp otherwise

2) Template:cpp if the contents of the strings are not equivalent, Template:cpp otherwise

3) Template:cpp if the contents of the lhs are lexicographically less than the contents of rhs, Template:cpp otherwise

4) Template:cpp if the contents of the lhs are lexicographically less than or equal the contents of rhs, Template:cpp otherwise

5) Template:cpp if the contents of the lhs are lexicographically greater than the contents of rhs, Template:cpp otherwise

6) Template:cpp if the contents of the lhs are lexicographically greater than or equal the contents of rhs, Template:cpp otherwise

Complexity

Linear in the size of the strings.