다음을 통해 공유


set::empty

Tests if a set is empty.

bool empty( ) const;

반환 값

true if the set is empty; false if the set is nonempty.

예제

// set_empty.cpp
// compile with: /EHsc
#include <set>
#include <iostream>

int main( )
{
   using namespace std;
   set <int> s1, s2;
   s1.insert ( 1 );

   if ( s1.empty( ) )
      cout << "The set s1 is empty." << endl;
   else
      cout << "The set s1 is not empty." << endl;

   if ( s2.empty( ) )
      cout << "The set s2 is empty." << endl;
   else
      cout << "The set s2 is not empty." << endl;
}
  

요구 사항

헤더: <설정>

네임스페이스: std

참고 항목

참조

set 클래스

set::empty 및 set::clear

표준 템플릿 라이브러리