Udostępnij za pośrednictwem


operator<= (<queue>)

Sprawdza, czy obiekt kolejki po lewej stronie operatora jest mniejsza niż lub 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 Jeśli kolejka po lewej stronie operatora jest ściśle mniej niż kolejki po prawej stronie operatora; w przeciwnym razie false.

Uwagi

Porównanie między obiekty typu kolejka opiera się na par porównanie ich elementów.Mniejszej lub równej do relacji między obiektami dwie kolejki opiera się na porównaniu pierwszej pary nierówne elementy.

Przykład

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

Wymagania

Nagłówek:<kolejki>

Przestrzeń nazw: std

Zobacz też

Informacje

Standardowa biblioteka szablonów