Condividi tramite


operator> (set)

Test se l'oggetto è impostato sul lato sinistro dell'operatore è maggiore dell'oggetto stabilito dalla destra.

bool operator>(
   const set <Key, Traits, Allocator>& _Left,
   const set <Key, Traits, Allocator>& _Right
);

Parametri

  • _Left
    Un oggetto di tipo SET.

  • _Right
    Un oggetto di tipo SET.

Valore restituito

true se impostato sul lato sinistro dell'operatore maggiore sul lato destro dell'operatore, in caso contrario false.

Note

Il confronto tra gli oggetti predefiniti è basato pairwise su un confronto dei relativi elementi.La relazione di maggiore tra due oggetti è basata su un confronto della prima coppia di elementi diversi.

Esempio

// set_op_gt.cpp
// compile with: /EHsc
#include <set>
#include <iostream>

int main( )
{
   using namespace std;
   set <int> s1, s2, s3;
   int i;

   for ( i = 0 ; i < 3 ; i++ )
   {
      s1.insert ( i );
      s2.insert ( i * i );
      s3.insert ( i - 1 );
   }

   if ( s1 > s2 )
      cout << "The set s1 is greater than the set s2." << endl;
   else
      cout << "The set s1 is not greater than the set s2." << endl;

   if ( s1 > s3 )
      cout << "The set s1 is greater than the set s3." << endl;
   else
      cout << "The set s1 is not greater than the set s3." << endl;
}
  
  

Requisiti

intestazione: <set>

Spazio dei nomi: deviazione standard

Vedere anche

Riferimenti

Libreria di modelli standard