Udostępnij za pośrednictwem


operator> (<queue>)

Testy, jeśli obiekt kolejki po lewej stronie operatora jest większa niż obiekt 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 Jeśli kolejka po lewej stronie operatora jest ściśle mniej niż kolejki po prawej stronie operatora; w przeciwnym razie false.

Uwagi

Porównanie kolejka opiera się na parowania porównanie ich elementów.Większa-niż relację między dwoma obiektami kolejki jest oparty na porównanie pierwszej pary nierówne elementy.

Przykład

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

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

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

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

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

Wymagania

Nagłówek: <queue>

Obszar nazw: std

Zobacz też

Informacje

Standardowa biblioteka szablonu