Nuta
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować się zalogować lub zmienić katalog.
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować zmienić katalogi.
Nagłówek <hash_set> zawiera następujące operatory:
operator!=
Uwaga
Ten interfejs API jest nieaktualny. Alternatywą jest klasa unordered_set.
Sprawdza, czy obiekt hash_set po lewej stronie operatora nie jest równy obiektowi hash_set po prawej stronie.
bool operator!=(const hash_set <Key, Traits, Allocator>& left, const hash_set <Key, Traits, Allocator>& right);
Parametry
Lewy
Obiekt typu hash_set.
Prawy
Obiekt typu hash_set.
Wartość zwracana
true jeśli hash_sets nie są równe; false jeśli hash_sets są równe.
Uwagi
Porównanie obiektów hash_set opiera się na porównaniu parowania między elementami. Dwie hash_sets są równe, jeśli mają taką samą liczbę elementów, a ich elementy mają te same wartości. W przeciwnym razie są one nierówne.
Elementy członkowskie plików nagłówków <hash_map> i <hash_set> znajdują się w przestrzeni nazw stdext.
Przykład
// hash_set_op_ne.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_set <int> hs1, hs2, hs3;
int i;
for ( i = 0 ; i < 3 ; i++ )
{
hs1.insert ( i );
hs2.insert ( i * i );
hs3.insert ( i );
}
if ( hs1 != hs2 )
cout << "The hash_sets hs1 and hs2 are not equal." << endl;
else
cout << "The hash_sets hs1 and hs2 are equal." << endl;
if ( hs1 != hs3 )
cout << "The hash_sets hs1 and hs3 are not equal." << endl;
else
cout << "The hash_sets hs1 and hs3 are equal." << endl;
}
The hash_sets hs1 and hs2 are not equal.
The hash_sets hs1 and hs3 are equal.
operator==
Uwaga
Ten interfejs API jest nieaktualny. Alternatywą jest klasa unordered_set.
Sprawdza, czy obiekt hash_set po lewej stronie operatora jest równy obiektowi hash_set po prawej stronie.
bool operator!==(const hash_set <Key, Traits, Allocator>& left, const hash_set <Key, Traits, Allocator>& right);
Parametry
Lewy
Obiekt typu hash_set.
Prawy
Obiekt typu hash_set.
Wartość zwracana
true jeśli hash_set po lewej stronie operatora jest równa hash_set po prawej stronie operatora; w przeciwnym razie false.
Uwagi
Porównanie obiektów hash_set opiera się na parowym porównywaniu ich elementów. Dwie hash_sets są równe, jeśli mają taką samą liczbę elementów, a ich elementy mają te same wartości. W przeciwnym razie są one nierówne.
Przykład
// hash_set_op_eq.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_set <int> s1, s2, s3;
int i;
for ( i = 0 ; i < 3 ; i++ )
{
s1.insert ( i );
s2.insert ( i * i );
s3.insert ( i );
}
if ( s1 == s2 )
cout << "The hash_sets s1 and s2 are equal." << endl;
else
cout << "The hash_sets s1 and s2 are not equal." << endl;
if ( s1 == s3 )
cout << "The hash_sets s1 and s3 are equal." << endl;
else
cout << "The hash_sets s1 and s3 are not equal." << endl;
}
The hash_sets s1 and s2 are not equal.
The hash_sets s1 and s3 are equal.
operator!= (hash_multiset)
Uwaga
Ten interfejs API jest nieaktualny. Alternatywą jest klasa unordered_set.
Sprawdza, czy obiekt hash_multiset po lewej stronie operatora nie jest równy obiektowi hash_multiset po prawej stronie.
bool operator!=(const hash_multiset <Key, Traits, Allocator>& left, const hash_multiset <Key, Traits, Allocator>& right);
Parametry
Lewy
Obiekt typu hash_multiset.
Prawy
Obiekt typu hash_multiset.
Wartość zwracana
true jeśli hash_multisets nie są równe; false jeśli hash_multisets są równe.
Uwagi
Porównanie obiektów hash_multiset opiera się na porównaniu parowania między elementami. Dwie hash_multisets są równe, jeśli mają taką samą liczbę elementów, a ich elementy mają te same wartości. W przeciwnym razie są one nierówne.
Przykład
// hashset_op_ne.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_multiset <int> hs1, hs2, hs3;
int i;
for ( i = 0 ; i < 3 ; i++ )
{
hs1.insert ( i );
hs2.insert ( i * i );
hs3.insert ( i );
}
if ( hs1 != hs2 )
cout << "The hash_multisets hs1 and hs2 are not equal." << endl;
else
cout << "The hash_multisets hs1 and hs2 are equal." << endl;
if ( hs1 != hs3 )
cout << "The hash_multisets hs1 and hs3 are not equal." << endl;
else
cout << "The hash_multisets hs1 and hs3 are equal." << endl;
}
The hash_multisets hs1 and hs2 are not equal.
The hash_multisets hs1 and hs3 are equal.
operator== (hash_multiset)
Uwaga
Ten interfejs API jest nieaktualny. Alternatywą jest klasa unordered_set.
Sprawdza, czy obiekt hash_multiset po lewej stronie operatora jest równy obiektowi hash_multiset po prawej stronie.
bool operator!==(const hash_multiset <Key, Traits, Allocator>& left, const hash_multiset <Key, Traits, Allocator>& right);
Parametry
Lewy
Obiekt typu hash_multiset.
Prawy
Obiekt typu hash_multiset.
Wartość zwracana
true jeśli hash_multiset po lewej stronie operatora jest równa hash_multiset po prawej stronie operatora; w przeciwnym razie false.
Uwagi
Porównanie obiektów hash_multiset opiera się na parowym porównywaniu ich elementów. Dwie hash_multisets są równe, jeśli mają taką samą liczbę elementów, a ich elementy mają te same wartości. W przeciwnym razie są one nierówne.
Przykład
// hash_multiset_op_eq.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_multiset <int> s1, s2, s3;
int i;
for ( i = 0 ; i < 3 ; i++ )
{
s1.insert ( i );
s2.insert ( i * i );
s3.insert ( i );
}
if ( s1 == s2 )
cout << "The hash_multisets s1 and s2 are equal." << endl;
else
cout << "The hash_multisets s1 and s2 are not equal." << endl;
if ( s1 == s3 )
cout << "The hash_multisets s1 and s2 are equal." << endl;
else
cout << "The hash_multisets s1 and s2 are not equal." << endl;
}
The hash_multisets s1 and s2 are not equal.
The hash_multisets s1 and s2 are equal.