Compartir a través de


hash_set::const_reference

[!NOTA]

Esta API está obsoleta.La alternativa es unordered_set Class.

Un tipo que proporciona una referencia a un elemento const almacenados en un hash_set para leer y realizar operaciones const .

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

Comentarios

En Visual C++ .NET 2003, los miembros de los archivos de encabezado <hash_map> y <hash_set> ya no están en el espacio de nombres std, pero se han movido bastante al espacio de nombres stdext.Vea El espacio de nombres stdext para obtener más información.

Ejemplo

// 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;
}
  

Requisitos

Encabezado: <hash_set>

Stdext deEspacio de nombres:

Vea también

Referencia

hash_set Class

Biblioteca de plantillas estándar