Export (0) Print
Expand All

operator> (<list>)

Tests if the list object on the left side of the operator is greater than the list object on the right side.

bool operator>( 
   const list<Type, Allocator>& _Left, 
   const list<Type, Allocator>& _Right 
);

_Left

An object of type list.

_Right

An object of type list.

true if the list on the left side of the operator is greater than the list on the right side of the operator; otherwise false.

The comparison between list objects is based on a pairwise comparison of their elements. The greater-than relationship between two objects is based on a comparison of the first pair of unequal elements.

// list_op_gt.cpp
// compile with: /EHsc
#include <list>
#include <iostream>
int main( ) 
{
   using namespace std; 
   list <int> c1, c2;
   c1.push_back( 1 );
   c1.push_back( 3 );
   c1.push_back( 1 );

   c2.push_back( 1 );
   c2.push_back( 2 );
   c2.push_back( 2 );

   if ( c1 > c2 )
      cout << "List c1 is greater than list c2." << endl;
   else
      cout << "List c1 is not greater than list c2." << endl;
}
List c1 is greater than list c2.

Header: <list>

Namespace: std

Community Additions

ADD
Show:
© 2014 Microsoft