![]() |
---|
此 API 已过时。另一种方法是 unordered_multiset Class。 |
提供对元素的类型在 hash_multiset 存储状态。
typedef list<typename _Traits::value_type, typename _Traits::allocator_type>::reference reference;
备注
在 Visual C++ .NET 2003 中,<hash_map> 和 <hash_set> 标头文件的成员中不再标准,命名空间,而是将 stdext 命名空间。有关更多信息,请参见 stdext 命名空间。
示例
// hash_multiset_reference.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_multiset <int> hms1;
hms1.insert( 10 );
hms1.insert( 20 );
// Declare and initialize a reference &Ref1 to the 1st element
int &Ref1 = *hms1.begin( );
cout << "The first element in the hash_multiset is "
<< Ref1 << "." << endl;
// The value of the 1st element of the hash_multiset can be
// changed by operating on its (non const) reference
Ref1 = Ref1 + 5;
cout << "The first element in the hash_multiset is now "
<< *hms1.begin() << "." << endl;
}
要求
标头: <hash_set>
命名空间: stdext