operator== (multimap)
Testet, ob das multimap-Objekt auf der linken Seite des Operators multimap-Objekt gleich dem auf der rechten Seite ist.
bool operator==(
const multimap <Key, Type, Traits, Allocator>& _Left,
const multimap <Key, Type, Traits, Allocator>& _Right
);
Parameter
_Left
Ein Objekt vom Typ multimap._Right
Ein Objekt vom Typ multimap.
Rückgabewert
true, wenn die Multimap auf der linken Seite des Operators gleich der Multimap auf der rechten Seite des Operators ist; andernfalls false.
Hinweise
Der Vergleich zwischen multimap-Objekten ist anhand einer paarweisen Vergleich ihrer Elemente. Zwei Multimaps sind gleich, wenn sie dieselbe Anzahl von Elementen aufweisen und ihre jeweiligen Elemente dieselben Werte verfügen. Andernfalls sind sie ungleich.
Beispiel
// multimap_op_eq.cpp
// compile with: /EHsc
#include <map>
#include <iostream>
int main( )
{
using namespace std;
multimap<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 << "m1 and m2 are equal" << endl;
else
cout << "m1 and m2 are not equal" << endl;
if ( m1 == m3 )
cout << "m1 and m3 are equal" << endl;
else
cout << "m1 and m3 are not equal" << endl;
}
Anforderungen
Header: <map>
Namespace: std