Udostępnij za pośrednictwem


operator<= (set)

Testy, jeśli zestaw obiektów po lewej stronie operatora jest mniejsza lub równa obiektu zestawu po prawej stronie.

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

Parametry

  • _Left
    Obiekt typu set.

  • _Right
    Obiekt typu set.

Wartość zwracana

TRUE , jeśli zestaw po lewej stronie operatora jest mniejsza niż zestaw po prawej stronie operatora; w przeciwnym razie false.

Uwagi

Porównanie między obiektami zestaw opiera się na parowania porównanie ich elementów.Mniejszej lub równej relacji między dwoma obiektami opiera się na porównaniu pierwszej pary nierówne elementy.

Przykład

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

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

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

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

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

   if ( s1 <= s4 )
      cout << "Set s1 is less than or equal to the set s4." << endl;
   else
      cout << "The set s1 is greater than the set s4." << endl;
}
  
  
  

Wymagania

Nagłówek: <set>

Obszar nazw: std

Zobacz też

Informacje

Standardowa biblioteka szablonu