次の方法で共有


operator> (<queue>)

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

bool operator>(
   const queue <Type, Container>& _Left,
   const queue <Type, Container>& _Right,
);

パラメーター

  • _Left
    queue型のオブジェクト。

  • _Right
    queue型のオブジェクト。

戻り値

演算子の左側のキューが null の場合、演算子の右側のキュー未満true ; それ false

解説

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

使用例

// queue_op_gt.cpp
// compile with: /EHsc
#include <queue>
#include <iostream>

int main( )
{
   using namespace std;
   queue <int> q1, q2, q3;

   q1.push( 1 );
   q1.push( 2 );
   q1.push( 3 );
   q2.push( 5 );
   q2.push( 10 );
   q3.push( 1 );
   q3.push( 2 );

   if ( q1 > q2 )
      cout << "The queue q1 is greater than "
           << "the queue q2." << endl;
   else
      cout << "The queue q1 is not greater than "
           << "the queue q2." << endl;

   if ( q1> q3 )
      cout << "The queue q1 is greater than "
           << "the queue q3." << endl;
   else
      cout << "The queue q1 is not greater than "
           << "the queue q3." << endl;
}
  
  

必要条件

ヘッダー: <queue>

名前空間: std

参照

関連項目

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