Udostępnij za pośrednictwem


vector::empty

Testy, jeśli wektor jest pusty.

bool empty( ) const;

Wartość zwracana

TRUE Jeśli wektor jest pusty; FALSE jeżeli wektor nie jest pusty.

Przykład

// vector_empty.cpp
// compile with: /EHsc
#include <vector>
#include <iostream>

int main( )
{
   using namespace std;   
   vector <int> v1;

   v1.push_back( 10 );

   if ( v1.empty( ) )
      cout << "The vector is empty." << endl;
   else
      cout << "The vector is not empty." << endl;
}
  

Wymagania

Nagłówek: <vector>

Obszar nazw: std

Zobacz też

Informacje

vector Class

vector::empty, vector::erase, i vector::push_back

Standardowa biblioteka szablonu