hash_set::reference
![]() |
---|
Этот API устарел.Альтернативы unordered_set Class. |
Тип, который предоставляет ссылку на элемент, хранящийся в hash_set.
typedef list<typename Traits::value_type, typename Traits::allocator_type>::reference reference;
Заметки
В Visual C++ .NET 2003 <hash_map> элементы файлов заголовков и <hash_set> больше не находятся в пространстве имен std, но скорее перейти на пространство имен stdext.Дополнительные сведения см. в разделе Пространство имен stdext.
Пример
// hash_set_reference.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_set <int> hs1;
hs1.insert( 10 );
hs1.insert( 20 );
// Declare and initialize a reference &Ref1 to the 1st element
int &Ref1 = *hs1.begin( );
cout << "The first element in the hash_set is "
<< Ref1 << "." << endl;
// The value of the 1st element of the hash_set can be changed
// by operating on its (non-const) reference
Ref1 = Ref1 + 5;
cout << "The first element in the hash_set is now "
<< *hs1.begin() << "." << endl;
}
Требования
заголовок: <hash_set>
Stdext пространство имен: