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 型のオブジェクト。
戻り値
hash_setsがではないtrue ; hash_setsが等しい場合 false。
解説
hash_setのオブジェクトの比較は、要素間には一対の比較に基づいています。2個のhash_setsは、要素の数が同じで、対応する要素の値が同じ同じです。それ以外の場合は等しくありません。
Visual C++ .NET 2003では、<hash_map> と <hash_set> ヘッダー ファイルのメンバーはstdの名前空間に存在しなくなりましたが、ではなくstdextの名前空間に型。詳細については、「The stdext Namespace」を参照してください。
使用例
// 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