list::empty
Testy, jeśli lista jest pusta.
bool empty( ) const;
Wartość zwracana
TRUE , jeśli lista jest pusta; FALSE , jeśli lista nie jest pusta.
Przykład
// list_empty.cpp
// compile with: /EHsc
#include <list>
#include <iostream>
int main( )
{
using namespace std;
list <int> c1;
c1.push_back( 10 );
if ( c1.empty( ) )
cout << "The list is empty." << endl;
else
cout << "The list is not empty." << endl;
}
Wymagania
Nagłówek: <list>
Obszar nazw: std