Compartir a través de


hash_map::empty

Nota

Esta API está obsoleta.La alternativa es unordered_map (Clase).

Prueba si un hash_map está vacío.

bool empty( ) const;

Valor devuelto

true si el hash_map está vacío; false si el hash_map no está vacío.

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, sino que se han movido al espacio de nombres stdext. Vea El espacio de nombres stdext para obtener más información.

Ejemplo

// hash_map_empty.cpp
// compile with: /EHsc
#include <hash_map>
#include <iostream>

int main( )
{
   using namespace std;
   using namespace stdext;
   hash_map <int, int> hm1, hm2;

   typedef pair <int, int> Int_Pair;
   hm1.insert ( Int_Pair ( 1, 1 ) );

   if ( hm1.empty( ) )
      cout << "The hash_map hm1 is empty." << endl;
   else
      cout << "The hash_map hm1 is not empty." << endl;

   if ( hm2.empty( ) )
      cout << "The hash_map hm2 is empty." << endl;
   else
      cout << "The hash_map hm2 is not empty." << endl;
}
  

Requisitos

Encabezado: <hash_map>

Espacio de nombres: stdext

Vea también

Referencia

hash_map (Clase)

Biblioteca de plantillas estándar