Поделиться через


hash_set::const_reference

ПримечаниеПримечание

Этот API устарел.Альтернативы unordered_set Class.

Тип, который предоставляет ссылку на элемент const, хранящиеся в hash_set для чтения и для выполнения операций const.

typedef list<typename Traits::value_type, typename Traits::allocator_type>::const_reference const_reference;

Заметки

В Visual C++ .NET 2003 <hash_map> элементы файлов заголовков и <hash_set> больше не находятся в пространстве имен std, но скорее перейти на пространство имен stdext.Дополнительные сведения см. в разделе Пространство имен stdext.

Пример

// hash_set_const_ref.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 const_reference &Ref1 
   // to the 1st element
   const int &Ref1 = *hs1.begin( );

   cout << "The first element in the hash_set is "
        << Ref1 << "." << endl;

   // The following line would cause an error because the 
   // const_reference cannot be used to modify the hash_set
   // Ref1 = Ref1 + 5;
}
  

Требования

заголовок: <hash_set>

Stdext пространство имен:

См. также

Ссылки

hash_set Class

Стандартная библиотека шаблонов