Notitie
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen u aan te melden of de directory te wijzigen.
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen de mappen te wijzigen.
operators voor
De <hash_map> header biedt de volgende operators:
operator!=
Opmerking
Deze API is verouderd. Het alternatief is unordered_map Class.
Test of het hash_map object aan de linkerkant van de operator niet gelijk is aan het hash_map object aan de rechterkant.
bool operator!=(const hash_map <Key, Type, Traits, Allocator>& left, const hash_map <Key, Type, Traits, Allocator>& right);
Parameterwaarden
links
Een object van het type hash_map.
rechts
Een object van het type hash_map.
Retourwaarde
true indien de hash_maps niet gelijk zijn; false als hash_maps gelijk zijn.
Opmerkingen
De vergelijking tussen hash_map objecten is gebaseerd op een paargewijze vergelijking van hun elementen. Twee hash_maps zijn gelijk als ze hetzelfde aantal elementen hebben en hun respectieve elementen dezelfde waarden hebben. Anders zijn ze ongelijk.
Leden van de <hash_map> - en <hash_set> headerbestanden in de stdext-naamruimte.
Voorbeeld
// 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==
Opmerking
Deze API is verouderd. Het alternatief is unordered_map Class.
Test of het hash_map-object aan de linkerkant van de operator gelijk is aan het hash_map object aan de rechterkant.
bool operator==(const hash_map <Key, Type, Traits, Allocator>& left, const hash_map <Key, Type, Traits, Allocator>& right);
Parameterwaarden
links
Een object van het type hash_map.
rechts
Een object van het type hash_map.
Retourwaarde
true indien de hash_map aan de linkerkant van de operator gelijk is aan de hash_map aan de rechterkant van de operator; anders false.
Opmerkingen
De vergelijking tussen hash_map objecten is gebaseerd op een paargewijze vergelijking van hun elementen. Twee hash_maps zijn gelijk als ze hetzelfde aantal elementen hebben en hun respectieve elementen dezelfde waarden hebben. Anders zijn ze ongelijk.
Voorbeeld
// 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)
Opmerking
Deze API is verouderd. Het alternatief is unordered_multimap Klasse.
Test of het hash_multimap object aan de linkerkant van de operator niet gelijk is aan het hash_multimap object aan de rechterkant.
bool operator!=(const hash_multimap <Key, Type, Traits, Allocator>& left, const hash_multimap <Key, Type, Traits, Allocator>& right);
Parameterwaarden
links
Een object van het type hash_multimap.
rechts
Een object van het type hash_multimap.
Retourwaarde
true indien de hash_multimaps niet gelijk zijn; false als hash_multimaps gelijk zijn.
Opmerkingen
De vergelijking tussen hash_multimap objecten is gebaseerd op een paargewijze vergelijking van hun elementen. Twee hash_multimaps zijn gelijk als ze hetzelfde aantal elementen hebben en hun respectieve elementen dezelfde waarden hebben. Anders zijn ze ongelijk.
Voorbeeld
// 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)
Opmerking
Deze API is verouderd. Het alternatief is unordered_multimap Klasse.
Test of het hash_multimap object aan de linkerkant van de operator gelijk is aan het hash_multimap object aan de rechterkant.
bool operator==(const hash_multimap <Key, Type, Traits, Allocator>& left, const hash_multimap <Key, Type, Traits, Allocator>& right);
Parameterwaarden
links
Een object van het type hash_multimap.
rechts
Een object van het type hash_multimap.
Retourwaarde
true indien de hash_multimap aan de linkerkant van de operator gelijk is aan de hash_multimap aan de rechterkant van de operator; anders false.
Opmerkingen
De vergelijking tussen hash_multimap objecten is gebaseerd op een paargewijze vergelijking van hun elementen. Twee hash_multimaps zijn gelijk als ze hetzelfde aantal elementen hebben en hun respectieve elementen dezelfde waarden hebben. Anders zijn ze ongelijk.
Voorbeeld
// 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.