Sdílet prostřednictvím


hash_map::empty

[!POZNÁMKA]

Toto rozhraní API je zastaralé.Alternativou je unordered_map – třída.

Zkoušky, pokud hash_map je prázdný.

bool empty( ) const;

Vrácená hodnota

true -li hash_map je prázdná. false je-li hash_map neprázdné.

Poznámky

V aplikaci Visual C++ .NET 2003, členové hlavičkových souborů tříd <hash_map> a <hash_set> již nejsou v oboru názvů std, ale byly přesunuty do oboru názvů stdext.Další informace naleznete v tématu Obor názvů stdext.

Příklad

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

Požadavky

Hlavička: <hash_map>

Obor názvů: stdext

Viz také

Referenční dokumentace

hash_map – třída

Standardní knihovna šablon