operator> (<list>)

测试运算符左侧的列表对象是否大于右侧的列表对象。

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

参数

  • _Left
    类型 list 的对象。

  • _Right
    类型 list 的对象。

返回值

如果运算符左侧的列表大于右侧的列表,则为 true,否则为 false

备注

列表对象之间的比较基于其元素的成对比较。 两个对象之间的大于关系基于首对不相等元素之间的比较。

示例

// 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>

命名空间: std

请参见

参考

list 类

标准模板库