Uwaga
Dostęp do tej strony wymaga autoryzacji. Może spróbować zalogować się lub zmienić katalogi.
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować zmienić katalogi.
Sprawdza, czy obiekt zestawu po lewej stronie operatora jest mniejsza niż obiektu zestawu po prawej stronie.
bool operator<(
const set <Key, Traits, Allocator>& _Left,
const set <Key, Traits, Allocator>& _Right
);
Parametry
_Left
Obiekt typu zestaw._Right
Obiekt typu zestaw.
Wartość zwracana
TRUE Jeśli zestaw po lewej stronie operatora jest ściśle mniej niż zestaw po prawej stronie operatora; w przeciwnym razie false.
Uwagi
Porównanie między obiektami zestaw opiera się na par porównanie ich elementów.Mniej-niż relację między dwoma obiektami jest oparte na porównaniu pierwszej pary nierówne elementy.
Przykład
// set_op_lt.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 less than the set s2." << endl;
else
cout << "The set s1 is not less than the set s2." << endl;
if ( s1 < s3 )
cout << "The set s1 is less than the set s3." << endl;
else
cout << "The set s1 is not less than the set s3." << endl;
}
Wymagania
Nagłówek: <set>
Przestrzeń nazw: std