Condividi tramite


operator>= (<stack>)

Test se l'oggetto dello stack a sinistra dell'operatore è maggiore o uguale all'oggetto stack a destra.

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

Parametri

  • _Left
    Un oggetto di tipo stack.

  • _Right
    Un oggetto di tipo stack.

Valore restituito

true se lo stack a sinistra dell'operatore è rigorosamente minore dello stack sul lato destro dell'operatore, in caso contrario false.

Note

Il confronto tra gli oggetti dello stack è basato pairwise su un confronto dei relativi elementi.Maggiore o uguale alla relazione tra due oggetti dello stack è basata su un confronto della prima coppia di elementi diversi.

Esempio

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

Requisiti

intestazione: <stack>

Spazio dei nomi: deviazione standard

Vedere anche

Riferimenti

Libreria di modelli standard