Kommentar
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Rubriken <hash_map> innehåller följande operatorer:
operator!=
Anmärkning
Det här API:et är föråldrat. Alternativet är unordered_map Klass.
Testar om hash_map-objektet till vänster om operatorn inte är lika med det hash_map objektet till höger.
bool operator!=(const hash_map <Key, Type, Traits, Allocator>& left, const hash_map <Key, Type, Traits, Allocator>& right);
Parameterar
vänster
Ett objekt av typen hash_map.
rätt
Ett objekt av typen hash_map.
Returvärde
true om hash_maps inte är lika med; false om hash_maps är lika med.
Anmärkningar
Jämförelsen mellan hash_map objekt baseras på en parvis jämförelse av deras element. Två hash_maps är lika om de har samma antal element och deras respektive element har samma värden. Annars är de ojämlika.
Medlemmar i huvudfilerna< hash_map> och <hash_set> i stdext-namnområdet.
Exempel
// 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==
Anmärkning
Det här API:et är föråldrat. Alternativet är unordered_map Klass.
Testar om hash_map-objektet till vänster om operatorn är lika med det hash_map objektet till höger.
bool operator==(const hash_map <Key, Type, Traits, Allocator>& left, const hash_map <Key, Type, Traits, Allocator>& right);
Parameterar
vänster
Ett objekt av typen hash_map.
rätt
Ett objekt av typen hash_map.
Returvärde
true Om hash_map till vänster om operatorn är lika med hash_map till höger om operatorn, annars false.
Anmärkningar
Jämförelsen mellan hash_map objekt baseras på en parvis jämförelse av deras element. Två hash_maps är lika om de har samma antal element och deras respektive element har samma värden. Annars är de ojämlika.
Exempel
// 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)
Anmärkning
Det här API:et är föråldrat. Alternativet är unordered_multimap-klass.
Testar om hash_multimap-objektet till vänster om operatorn inte är lika med det hash_multimap objektet till höger.
bool operator!=(const hash_multimap <Key, Type, Traits, Allocator>& left, const hash_multimap <Key, Type, Traits, Allocator>& right);
Parameterar
vänster
Ett objekt av typen hash_multimap.
rätt
Ett objekt av typen hash_multimap.
Returvärde
true om hash_multimaps inte är lika med; false om hash_multimaps är lika.
Anmärkningar
Jämförelsen mellan hash_multimap objekt baseras på en parvis jämförelse av deras element. Två hash_multimaps är lika om de har samma antal element och deras respektive element har samma värden. Annars är de ojämlika.
Exempel
// 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)
Anmärkning
Det här API:et är föråldrat. Alternativet är unordered_multimap-klass.
Testar om hash_multimap-objektet till vänster om operatorn är lika med det hash_multimap objektet till höger.
bool operator==(const hash_multimap <Key, Type, Traits, Allocator>& left, const hash_multimap <Key, Type, Traits, Allocator>& right);
Parameterar
vänster
Ett objekt av typen hash_multimap.
rätt
Ett objekt av typen hash_multimap.
Returvärde
true Om hash_multimap till vänster om operatorn är lika med hash_multimap till höger om operatorn, annars false.
Anmärkningar
Jämförelsen mellan hash_multimap objekt baseras på en parvis jämförelse av deras element. Två hash_multimaps är lika om de har samma antal element och deras respektive element har samma värden. Annars är de ojämlika.
Exempel
// 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.