list::empty
목록이 비어 있는지 여부를 테스트합니다.
bool empty( ) const;
반환 값
목록이 비어 있으면 true이고 비어 있지 않으면 false입니다.
예제
// 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;
}
요구 사항
헤더: <list>
네임스페이스: std