operator!= (<queue>)

如果在运算符左侧的队列对象与右侧,的队列对象不相等测试。

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

参数

  • _Left
    类型 queue对象。

  • _Right
    类型 queue对象。

返回值

true,如果队列不相等; false,如果队列相等。

备注

在队列对象之间的比较根据其元素的比较pairwise。两个队列相等;如果它们具有相同元素数目,并且其各自的元素具有相同的值。否则为不相等。

示例

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

请参见

参考

标准模板库