共用方式為


operator> (<queue>)

測試,如果在運算子左方的佇列對像大於右邊的佇列應用程式。

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

參數

  • _Left
    型別 queue物件。

  • _Right
    型別 queue物件。

傳回值

true ,如果在運算子左方的佇列明顯小於佇列在運算子右方的;否則 false

備註

在佇列物件之間的比較可能會依據其項目比較配對。 大於兩個佇列物件之間的關聯性會根據第一個要比較不相等的項目。

範例

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

需求

標題: <佇列>

命名空間: std

請參閱

參考

標準樣板程式庫