operator!= (hash_map)
![]() |
---|
這個 API 已經過時。這個選項是 unordered_map Class。 |
測試,如果在運算子左方的 hash_map 物件等於右邊的 hash_map 物件不相等。
bool operator!=(
const hash_map <Key, Type, Traits, Allocator>& _Left,
const hash_map <Key, Type, Traits, Allocator>& _Right
);
參數
_Left
型別 hash_map 的物件。_Right
型別 hash_map 的物件。
傳回值
true ,如果 hash_maps 不相等; false ,如果 hash_maps 相等。
備註
在 hash_map 物件之間的比較依據其項目比較中的方式。 兩 hash_maps 相等,則它們具有相同項目數目,且其元素具有相同的值。 否則就是不相等。
在 Visual C++ .NET Pocket PC, <hash_map> 和 <hash_set> 標頭檔 (Header File) 的成員不在 std 命名空間,,而是移至 stdext 命名空間。 如需詳細資訊,請參閱 stdext 命名空間。
範例
// hash_map_op_ne.cpp
// compile with: /EHsc
#include <hash_map>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_map <int, int> hm1, hm2, hm3;
int i;
typedef pair <int, int> Int_Pair;
for ( i = 0 ; i < 3 ; i++ )
{
hm1.insert ( Int_Pair ( i, i ) );
hm2.insert ( Int_Pair ( i, i * i ) );
hm3.insert ( Int_Pair ( i, i ) );
}
if ( hm1 != hm2 )
cout << "The hash_maps hm1 and hm2 are not equal." << endl;
else
cout << "The hash_maps hm1 and hm2 are equal." << endl;
if ( hm1 != hm3 )
cout << "The hash_maps hm1 and hm3 are not equal." << endl;
else
cout << "The hash_maps hm1 and hm3 are equal." << endl;
}
需求
標題: <hash_map>
命名空間: stdext