次の方法で共有


operator> (<list>)

演算子の左側のオブジェクトが右側のオブジェクトより大きいリストのテスト。

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

パラメーター

  • _Left
    **[リスト]**型のオブジェクト。

  • _Right
    **[リスト]**型のオブジェクト。

戻り値

演算子の左側の一覧が演算子の右側のリストよりも大きい場合true ; それ false

解説

リスト オブジェクトの比較は、要素のペアに比較に基づいています。2 個のオブジェクト間の関係に不等号最初のペアの付いていない要素の比較に基づいています。

使用例

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

参照

関連項目

標準テンプレート ライブラリ