Aracılığıyla paylaş


<hash_map> işleçleri

<hash_map> Üst bilgi aşağıdaki işleçleri sağlar:

işleç!=

Not

Bu, API artık kullanılmıyor. Alternatif olarak sınıf unordered_map.

İşlecin sol tarafındaki hash_map nesnesinin sağ taraftaki hash_map nesnesine eşit olup olmadığını sınar.

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

Parametreler

Sol
hash_map türünün bir nesnesi.

Sağ
hash_map türünün bir nesnesi.

Dönüş Değeri

true hash_maps eşit değilse; false hash_maps eşitse.

Açıklamalar

hash_map nesneleri arasındaki karşılaştırma, öğelerinin çift tabanlı karşılaştırmasını temel alır. İki hash_maps, aynı sayıda öğeye sahipse ve ilgili öğeleri aynı değerlere sahipse eşittir. Aksi takdirde eşit değillerdir.

<stdext Ad Alanında hash_map> ve< hash_set> üst bilgi dosyalarının üyeleri.

Örnek

// 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;
}
The hash_maps hm1 and hm2 are not equal.
The hash_maps hm1 and hm3 are equal.

operator==

Not

Bu, API artık kullanılmıyor. Alternatif olarak sınıf unordered_map.

İşlecin sol tarafındaki hash_map nesnesinin sağ taraftaki hash_map nesnesine eşit olup olmadığını sınar.

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

Parametreler

Sol
hash_map türünün bir nesnesi.

Sağ
hash_map türünün bir nesnesi.

Dönüş Değeri

true işlecin sol tarafındaki hash_map işlecin sağ tarafındaki hash_map eşitse; aksi takdirde false.

Açıklamalar

hash_map nesneleri arasındaki karşılaştırma, öğelerinin çift tabanlı karşılaştırmasını temel alır. İki hash_maps, aynı sayıda öğeye sahipse ve ilgili öğeleri aynı değerlere sahipse eşittir. Aksi takdirde eşit değillerdir.

Örnek

// hash_map_op_eq.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 equal." << endl;
   else
      cout << "The hash_maps hm1 and hm2 are not equal." << endl;

   if ( hm1 == hm3 )
      cout << "The hash_maps hm1 and hm3 are equal." << endl;
   else
      cout << "The hash_maps hm1 and hm3 are not equal." << endl;
}
The hash_maps hm1 and hm2 are not equal.
The hash_maps hm1 and hm3 are equal.

operator!= (hash_multimap)

Not

Bu, API artık kullanılmıyor. Alternatif olarak sınıf unordered_multimap.

İşlecin sol tarafındaki hash_multimap nesnesinin sağ taraftaki hash_multimap nesnesine eşit olup olmadığını sınar.

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

Parametreler

Sol
hash_multimap türünün bir nesnesi.

Sağ
hash_multimap türünün bir nesnesi.

Dönüş Değeri

true hash_multimaps eşit değilse; false hash_multimaps eşitse.

Açıklamalar

hash_multimap nesneleri arasındaki karşılaştırma, öğelerinin çift tabanlı karşılaştırmasını temel alır. İki hash_multimaps, aynı sayıda öğeye sahipse ve ilgili öğeleri aynı değerlere sahipse eşittir. Aksi takdirde eşit değillerdir.

Örnek

// hash_multimap_op_ne.cpp
// compile with: /EHsc
#include <hash_map>
#include <iostream>

int main( )
{
   using namespace std;
   using namespace stdext;
   hash_multimap <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_multimaps hm1 and hm2 are not equal." << endl;
   else
      cout << "The hash_multimaps hm1 and hm2 are equal." << endl;

   if ( hm1 != hm3 )
      cout << "The hash_multimaps hm1 and hm3 are not equal." << endl;
   else
      cout << "The hash_multimaps hm1 and hm3 are equal." << endl;
}
The hash_multimaps hm1 and hm2 are not equal.
The hash_multimaps hm1 and hm3 are equal.

operator== (hash_multimap)

Not

Bu, API artık kullanılmıyor. Alternatif olarak sınıf unordered_multimap.

İşlecin sol tarafındaki hash_multimap nesnesinin sağ taraftaki hash_multimap nesnesine eşit olup olmadığını sınar.

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

Parametreler

Sol
hash_multimap türünün bir nesnesi.

Sağ
hash_multimap türünün bir nesnesi.

Dönüş Değeri

true işlecin sol tarafındaki hash_multimap işlecin sağ tarafındaki hash_multimap eşitse; aksi takdirde false.

Açıklamalar

hash_multimap nesneleri arasındaki karşılaştırma, öğelerinin çift tabanlı karşılaştırmasını temel alır. İki hash_multimaps, aynı sayıda öğeye sahipse ve ilgili öğeleri aynı değerlere sahipse eşittir. Aksi takdirde eşit değillerdir.

Örnek

// hash_multimap_op_eq.cpp
// compile with: /EHsc
#include <hash_map>
#include <iostream>

int main( )
{
   using namespace std;
   using namespace stdext;
   hash_multimap<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_multimaps hm1 and hm2 are equal." << endl;
   else
      cout << "The hash_multimaps hm1 and hm2 are not equal." << endl;

   if ( hm1 == hm3 )
      cout << "The hash_multimaps hm1 and hm3 are equal." << endl;
   else
      cout << "The hash_multimaps hm1 and hm3 are not equal." << endl;
}
The hash_multimaps hm1 and hm2 are not equal.
The hash_multimaps hm1 and hm3 are equal.

Ayrıca bkz.

<hash_map>