Namespaces
Variants
Views
Actions

Difference between revisions of "Template:cpp/container/operator cmp"

From cppreference.com
m
(fmt)
Line 61: Line 61:
  
 
===Return value===
 
===Return value===
1) {{c|true}} if the contents of the containers are equivalent, {{c|false}} otherwise
+
@1@ {{c|true}} if the contents of the containers are equivalent, {{c|false}} otherwise
  
2) {{c|true}} if the contents of the containers are not equivalent, {{c|false}} otherwise
+
@2@ {{c|true}} if the contents of the containers are not equivalent, {{c|false}} otherwise
  
3) {{c|true}} if the contents of the {{tt|lhs}} are lexicographically ''less'' than the contents of {{tt|rhs}}, {{c|false}} otherwise
+
@3@ {{c|true}} if the contents of the {{tt|lhs}} are lexicographically ''less'' than the contents of {{tt|rhs}}, {{c|false}} otherwise
  
4) {{c|true}} if the contents of the {{tt|lhs}} are lexicographically ''less'' than or ''equal'' the contents of {{tt|rhs}}, {{c|false}} otherwise
+
@4@ {{c|true}} if the contents of the {{tt|lhs}} are lexicographically ''less'' than or ''equal'' the contents of {{tt|rhs}}, {{c|false}} otherwise
  
5) {{c|true}} if the contents of the {{tt|lhs}} are lexicographically ''greater'' than the contents of {{tt|rhs}}, {{c|false}} otherwise
+
@5@ {{c|true}} if the contents of the {{tt|lhs}} are lexicographically ''greater'' than the contents of {{tt|rhs}}, {{c|false}} otherwise
  
6) {{c|true}} if the contents of the {{tt|lhs}} are lexicographically ''greater'' than or ''equal'' the contents of {{tt|rhs}}, {{c|false}} otherwise
+
@6@ {{c|true}} if the contents of the {{tt|lhs}} are lexicographically ''greater'' than or ''equal'' the contents of {{tt|rhs}}, {{c|false}} otherwise
  
 
===Complexity===
 
===Complexity===
 
Linear in the size of the container
 
Linear in the size of the container

Revision as of 01:32, 4 June 2013

template< ... >

bool operator==( const {{{1}}}<...>& lhs,

                 const {{{1}}}<...>& rhs );
(1)
template< ... >

bool operator!=( const {{{1}}}<...>& lhs,

                 const {{{1}}}<...>& rhs );
(2)
template< ... >

bool operator<( const {{{1}}}<...>& lhs,

                const {{{1}}}<...>& rhs );
(3)
template< ... >

bool operator<=( const {{{1}}}<...>& lhs,

                 const {{{1}}}<...>& rhs );
(4)
template< ... >

bool operator>( const {{{1}}}<...>& lhs,

                const {{{1}}}<...>& rhs );
(5)
template< ... >

bool operator>=( const {{{1}}}<...>& lhs,

                 const {{{1}}}<...>& rhs );
(6)

Compares the contents of two containers.

1-2) Checks if the contents of lhs and rhs are equal, that is, whether lhs.size() == rhs.size() and each element in lhs has equivalent element 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 std::lexicographical_compare.

Parameters

lhs, rhs - containers whose contents to compare

Return value

1) true if the contents of the containers are equivalent, false otherwise
2) true if the contents of the containers are not equivalent, false otherwise
3) true if the contents of the lhs are lexicographically less than the contents of rhs, false otherwise
4) true if the contents of the lhs are lexicographically less than or equal the contents of rhs, false otherwise
5) true if the contents of the lhs are lexicographically greater than the contents of rhs, false otherwise
6) true if the contents of the lhs are lexicographically greater than or equal the contents of rhs, false otherwise

Complexity

Linear in the size of the container