共用方式為


operator< (<queue>)

測試,如果左側的佇列物件大於右邊的佇列物件。

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

參數

  • _Left
    型別 queue物件。

  • _Right
    型別 queue物件。

傳回值

true ,如果左側的佇列比和不等於佇列小於在運算子的右邊,否則 false

備註

在佇列中物件之間的比較可能會依據其項目比較配對方式。 不超過兩個佇列物件之間的關聯性會在第一次對的比較不相等的項目。

範例

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

int main( )
{
   using namespace std;

   // Declares queues with default deque base container
   queue <int> q1, q2, q3;

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

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

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

需求

標題: <queue>

命名空間: std

請參閱

參考

標準樣板程式庫