Udostępnij za pośrednictwem


operator>= (<stack>)

Testy, jeśli obiekt stosu po lewej stronie operatora jest większa niż lub równa obiektu stosu po prawej stronie.

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

Parametry

  • _Left
    Obiekt typu stos.

  • _Right
    Obiekt typu stos.

Wartość zwracana

TRUE Jeśli stos po lewej stronie operatora jest ściśle mniej niż stosu po prawej stronie operatora; w przeciwnym razie false.

Uwagi

Porównanie obiektów na stosie opiera się na parowania porównanie ich elementów.Większa lub równa relację między dwoma stos obiektów opiera się na porównaniu pierwszej pary nierówne elementy.

Przykład

// stack_op_ge.cpp
// compile with: /EHsc
#include <stack>
#include <list>
#include <iostream>

int main( )
{
   using namespace std;

   // Declares stacks with list base container
   stack <int, list<int> > s1, s2, s3;

   s1.push( 1 );
   s1.push( 2 );
   s2.push( 5 );
   s2.push( 10 );
   s3.push( 1 );
   s3.push( 2 );

   if ( s1 >= s2 )
      cout << "The stack s1 is greater than or equal to "
           << "the stack s2." << endl;
   else
      cout << "The stack s1 is less than "
           << "the stack s2." << endl;

   if ( s1>= s3 )
      cout << "The stack s1 is greater than or equal to "
           << "the stack s3." << endl;
   else
      cout << "The stack s1 is less than "
           << "the stack s3." << endl;
}
  
  

Wymagania

Nagłówek: <stack>

Obszar nazw: std

Zobacz też

Informacje

Standardowa biblioteka szablonu