operator!= (hash_set)
![]() |
---|
這個 API 已經過時。替代方案是 unordered_set 類別。 |
測試,如果在運算子左方的 hash_set 物件不等於右邊的 hash_set 物件。
bool operator!=(
const hash_set <Key, Traits, Allocator>& _Left,
const hash_set <Key, Traits, Allocator>& _Right
);
參數
_Left
型別 hash_set 的物件。_Right
型別 hash_set 的物件。
傳回值
true ,如果 hash_sets 相等; false ,如果 hash_sets 相等。
備註
在 hash_set 物件之間的比較可能會根據其元素之間的比較配對。 兩 hash_sets 相等,如果它們有相同的元素數,且其元素具有相同的值。 否則就是不相等。
在 Visual C++ .NET 2003 中, <hash_map> 和 <hash_set> 標頭檔的成員不在 std 命名空間中,而是移至 stdext 命名空間。 如需詳細資訊,請參閱 stdext 命名空間。
範例
// 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;
}
需求
標頭: <hash_set>
**命名空間:**stdext