Export (0) Print
Expand All

list::empty

Tests if a list is empty.

bool empty( ) const;

true if the list is empty; false if the list is not empty.

// 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;
}
The list is not empty.

Header: <list>

Namespace: std

Community Additions

ADD
Show:
© 2015 Microsoft