Udostępnij za pośrednictwem


operator!= (<queue>)

Testy, jeśli obiekt kolejki po lewej stronie operatora nie jest równa obiektu kolejki po prawej stronie.

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

Parametry

  • _Left
    Obiekt typu kolejki.

  • _Right
    Obiekt typu kolejki.

Wartość zwracana

TRUE kolejki nie są równe; FALSE kolejki są równe.

Uwagi

Porównanie kolejka opiera się na parowania porównanie ich elementów.Dwie kolejki są równe, jeśli mają taką samą liczbę elementów i ich odpowiednich elementów mają te same wartości.W przeciwnym razie są nierówne.

Przykład

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

Wymagania

Nagłówek: <queue>

Obszar nazw: std

Zobacz też

Informacje

Standardowa biblioteka szablonu