次の方法で共有


list::empty

Tests if a list is empty.

bool empty( ) const;

Return Value

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

Example

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

Output

The list is not empty.

Requirements

Header: <list>

Namespace: std

See Also

Concepts

list Class

list Class Members

Standard Template Library