operator!= (<queue>)
演算子の左側のオブジェクトが右側キューのキュー オブジェクトと等しくないかどうかを調べます。
bool operator!=(
const queue <Type, Container>& _Left,
const queue <Type, Container>& _Right,
);
パラメーター
_Left
queue型のオブジェクト。_Right
queue型のオブジェクト。
戻り値
キューがではないtrue ; キューが等しい場合 false。
解説
キュー オブジェクトの比較は、要素のペアに比較に基づいています。2 種類のキューは要素の数が同じで、対応する要素の値が同じ同じです。それ以外の場合は等しくありません。
使用例
// queue_op_ne.cpp
// compile with: /EHsc
#include <queue>
#include <list>
#include <iostream>
int main( )
{
using namespace std;
// Declares queues with list base containers
queue <int, list<int> > q1, q2, q3;
// The following line would have caused an error because vector
// does not support pop_front( ) and so cannot be adapted
// by queue as a base container
// queue <int, vector<int> > q1, q2, q3;
q1.push( 1 );
q2.push( 1 );
q2.push( 2 );
q3.push( 1 );
if ( q1 != q2 )
cout << "The queues q1 and q2 are not equal." << endl;
else
cout << "The queues q1 and q2 are equal." << endl;
if ( q1 != q3 )
cout << "The queues q1 and q3 are not equal." << endl;
else
cout << "The queues q1 and q3 are equal." << endl;
}
必要条件
ヘッダー: <queue>
名前空間: std