备注
此 API 已过时。替代为 unordered_multiset 类。
检索中 hash_multiset 用于排序元素值比较对象的副本。
value_compare value_comp( ) const;
返回值
返回 hash_multiset 模板参数 Traits,包含函数对象用于散列和对的容器元素。
有关Traits 的更多信息,请参见主题hash_multiset 类 。
备注
存储的对象定义成员函数:
bool operator( _yValconst _xVal的键&,const Key&);
如果后者返回 true,_xVal 之前和与排序顺序的 _yVal 不等于。
注意和 key_comparevalue_compare 是模板参数 特征的同义词。 两个类型。hash_multiset 和 hash_multiset 类提供,它们用于 hash_map 和类 hash_multimap 的兼容性是相同的,因此,这些不同的。
在Visual C++ .NET 2003中,成员<hash_map> 和 <hash_set> 头文件不再在std命名空间,而是已经进入了stdext命名空间。 有关更多信息,请参见 stdext 命名空间。
示例
// hash_multiset_value_comp.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_multiset <int, hash_compare < int, less<int> > > hms1;
hash_multiset <int, hash_compare < int, less<int> > >::value_compare
vc1 = hms1.value_comp( );
bool result1 = vc1( 2, 3 );
if( result1 == true )
{
cout << "vc1( 2,3 ) returns value of true, "
<< "where vc1 is the function object of hms1."
<< endl;
}
else
{
cout << "vc1( 2,3 ) returns value of false, "
<< "where vc1 is the function object of hms1."
<< endl;
}
hash_multiset <int, hash_compare < int, greater<int> > > hms2;
hash_multiset<int, hash_compare < int, greater<int> > >::
value_compare vc2 = hms2.value_comp( );
bool result2 = vc2( 2, 3 );
if( result2 == true )
{
cout << "vc2( 2,3 ) returns value of true, "
<< "where vc2 is the function object of hms2."
<< endl;
}
else
{
cout << "vc2( 2,3 ) returns value of false, "
<< "where vc2 is the function object of hms2."
<< endl;
}
}
要求
Header: <hash_set>
**命名空间:**stdext