Freigeben über


map::empty

Testet, ob eine Zuordnung leer ist.

bool empty( ) const;

Rückgabewert

true, wenn die Zuordnung leer ist; false, wenn die Zuordnung nicht leer ist.

Beispiel

// map_empty.cpp
// compile with: /EHsc
#include <map>
#include <iostream>

int main( )
{
   using namespace std;
   map <int, int> m1, m2;

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

   if ( m1.empty( ) )
      cout << "The map m1 is empty." << endl;
   else
      cout << "The map m1 is not empty." << endl;

   if ( m2.empty( ) )
      cout << "The map m2 is empty." << endl;
   else
      cout << "The map m2 is not empty." << endl;
}
  

Anforderungen

Header: <map>

Namespace: std

Siehe auch

Referenz

map-Klasse

Standardvorlagenbibliothek