共用方式為


<hash_set>運算子</hash_set>

 

如需 Visual Studio 2017 的最新文件請參閱 Visual Studio 2017 文件

運算子 ! = 運算子 ! = (hash_multiset) 運算子 = =
運算子 = = (hash_multiset)

運算子 ! =

注意

這個 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 命名空間。</hash_set></hash_map> 請參閱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;  
}  
The hash_sets hs1 and hs2 are not equal.  
The hash_sets hs1 and hs3 are equal.  

運算子 = =

注意

這個 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_set 相等運算子右側 hash_set 否則false

備註

Hash_set 物件之間的比較是以其元素的成對比較為根據。 兩個 hash_sets 相等,如果有相同數目的項目,且個別元素擁有相同的值。 反之則為不相等。

在 Visual c + +.NET 2003,成員<hash_map><hash_set>標頭檔不再 std 命名空間,但而已移到 stdext 命名空間。</hash_set></hash_map> 請參閱stdext 命名空間如需詳細資訊。

範例

// 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.  

運算子 ! = (hash_multiset)

注意

這個 API 已過時。 替代方法是unordered_set 類別

測試運算子左邊的 hash_multiset 物件是否不等於右邊的 hash_multiset 物件。

bool operator!=(const hash_multiset <Key, Traits, Allocator>& left, const hash_multiset <Key, Traits, Allocator>& right);

參數

left
hash_multiset 類型的物件。

right
hash_multiset 類型的物件。

傳回值

true hash_multisets 是否不相等。false hash_multisets 是否相等。

備註

Hash_multiset 物件之間的比較是以其元素的成對比較為基礎。 兩個 hash_multisets 相等,如果有相同數目的項目,且個別元素擁有相同的值。 反之則為不相等。

在 Visual c + +.NET 2003,成員<hash_map><hash_set>標頭檔不再 std 命名空間,但而已移到 stdext 命名空間。</hash_set></hash_map> 請參閱stdext 命名空間如需詳細資訊。

範例

// 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.  

運算子 = = (hash_multiset)

注意

這個 API 已過時。 替代方法是unordered_set 類別

測試運算子左邊的 hash_multiset 物件是否等於右邊的 hash_multiset 物件。

bool operator!==(const hash_multiset <Key, Traits, Allocator>& left, const hash_multiset <Key, Traits, Allocator>& right);

參數

left
hash_multiset 類型的物件。

right
hash_multiset 類型的物件。

傳回值

true如果運算子左邊 hash_multiset 相等運算子右側 hash_multiset 否則false

備註

Hash_multiset 物件之間的比較是以其元素的成對比較為根據。 兩個 hash_multisets 相等,如果有相同數目的項目,且個別元素擁有相同的值。 反之則為不相等。

在 Visual c + +.NET 2003,成員<hash_map><hash_set>標頭檔不再 std 命名空間,但而已移到 stdext 命名空間。</hash_set></hash_map> 請參閱stdext 命名空間如需詳細資訊。

範例

// 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.  

另請參閱

<hash_set></hash_set>