次の方法で共有


operator<= (<queue>)

演算子の左側のオブジェクトが右側キューのキュー オブジェクト以下かどうかをテストします。

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

パラメーター

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

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

戻り値

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

解説

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

使用例

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

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

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

   if ( q1 <= q2 )
      cout << "The queue q1 is less than or equal to "
           << "the queue q2." << endl;
   else
      cout << "The queue q1 is greater than "
           << "the queue q2." << endl;

   if ( q1 <= q3 )
      cout << "The queue q1 is less than or equal to "
           << "the queue q3." << endl;
   else
      cout << "The queue q1 is greater than "
           << "the queue q3." << endl;
}
  
  

必要条件

ヘッダー: <queue>

名前空間: std

参照

関連項目

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