<hash_map>
Операторов
оператор!=
operator!= (multimap)
operator==
оператор== (multimap)
оператор!=
Примечание.
Этот элемент API устарел. Вместо него следует использовать класс unordered_map.
Проверяет неравенство объекта hash_map слева от оператора и объекта hash_map справа от оператора.
bool operator!=(const hash_map <Key, Type, Traits, Allocator>& left, const hash_map <Key, Type, Traits, Allocator>& right);
Параметры
left
Объект типа hash_map
.
right
Объект типа hash_map
.
Возвращаемое значение
true
Значение , если hash_maps не равны; false
Значение hash_maps равно.
Замечания
Сравнение между объектами hash_map основывается на попарном сравнении их элементов. Два объекта hash_map равны, если они содержат одинаковое количество элементов, а их соответствующие элементы имеют одинаковые значения. В противном случае они не равны.
Члены файлов заголовков <hash_map и <hash_set>> в пространстве имен stdext.
Пример
// 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==
Примечание.
Этот элемент API устарел. Вместо него следует использовать класс unordered_map.
Проверяет равенство объекта hash_map слева от оператора и объекта hash_map справа от оператора.
bool operator==(const hash_map <Key, Type, Traits, Allocator>& left, const hash_map <Key, Type, Traits, Allocator>& right);
Параметры
left
Объект типа hash_map
.
right
Объект типа hash_map
.
Возвращаемое значение
true
Значение , если hash_map в левой части оператора равно hash_map справа от оператора; в противном случае false
.
Замечания
Сравнение между объектами hash_map основывается на попарном сравнении их элементов. Два объекта hash_map равны, если они содержат одинаковое количество элементов, а их соответствующие элементы имеют одинаковые значения. В противном случае они не равны.
Пример
// 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)
Примечание.
Этот элемент API устарел. Вместо него следует использовать unordered_multimap Class.
Проверяет неравенство объекта hash_multimap слева от оператора и объекта hash_multimap справа от оператора.
bool operator!=(const hash_multimap <Key, Type, Traits, Allocator>& left, const hash_multimap <Key, Type, Traits, Allocator>& right);
Параметры
left
Объект типа hash_multimap
.
right
Объект типа hash_multimap
.
Возвращаемое значение
true
Значение , если hash_multimaps не равны; false
Значение hash_multimaps, если hash_multimaps равны.
Замечания
Сравнение между объектами hash_multimap основывается на попарном сравнении их элементов. Два объекта hash_multimap равны, если они содержат одинаковое количество элементов, а их соответствующие элементы имеют одинаковые значения. В противном случае они не равны.
Пример
// 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)
Примечание.
Этот элемент API устарел. Вместо него следует использовать unordered_multimap Class.
Проверяет равенство объекта hash_multimap слева от оператора и объекта hash_multimap справа от оператора.
bool operator==(const hash_multimap <Key, Type, Traits, Allocator>& left, const hash_multimap <Key, Type, Traits, Allocator>& right);
Параметры
left
Объект типа hash_multimap
.
right
Объект типа hash_multimap
.
Возвращаемое значение
true
Значение , если hash_multimap в левой части оператора равен hash_multimap справа от оператора; в противном случае false
.
Замечания
Сравнение между объектами hash_multimap основывается на попарном сравнении их элементов. Два объекта hash_multimap равны, если они содержат одинаковое количество элементов, а их соответствующие элементы имеют одинаковые значения. В противном случае они не равны.
Пример
// 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.