Aracılığıyla paylaş


operator== (map)

Sağ taraftaki harita nesnesi işlecinin sol tarafındaki harita nesnesi eşitse sınar.

bool operator==(
   const map <Key, Type, Traits, Allocator>& _Left,
   const map <Key, Type, Traits, Allocator>& _Right
);

Parametreler

  • _Left
    Bir nesne türü Harita.

  • _Right
    Bir nesne türü Harita.

Dönüş Değeri

gerçek ; işlecinin sağ tarafındaki map haritayı işlecinin sol tarafındaki eşitse Aksi halde yanlış.

Notlar

Eşlem nesneleri arasında karşılaştırma öðelerinin yapılandırdı Karşılaştırmasında esas alır. Bunlar aynı sayıda öğe varsa ve bunların ilgili öğeleri aynı değerlere sahip iki eşlemeleri eşit. Aksi halde, bunlar eşit olmayan.

Örnek

// map_op_eq.cpp
// compile with: /EHsc
#include <map>
#include <iostream>

int main( )
{
   using namespace std;
   map < int, int > m1, m2, m3;
   int i;
   typedef pair < int, int > Int_Pair;

   for ( i = 0 ; i < 3 ; i++ )
   {
      m1.insert ( Int_Pair ( i, i ) );
      m2.insert ( Int_Pair ( i, i * i ) );
      m3.insert ( Int_Pair ( i, i ) );
   }

   if ( m1 == m2 )
      cout << "The maps m1 and m2 are equal." << endl;
   else
      cout << "The maps m1 and m2 are not equal." << endl;

   if ( m1 == m3 )
      cout << "The maps m1 and m3 are equal." << endl;
   else
      cout << "The maps m1 and m3 are not equal." << endl;
}
  
  

Gereksinimler

Başlık: <map>

Namespace: std

Ayrıca bkz.

Başvuru

Standart Şablon Kütüphanesi