다음을 통해 공유


set::clear

집합의 모든 요소를 지웁니다.

void clear( );

예제

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

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

   cout << "The size of the set is initially " << s1.size( )
        << "." << endl;

   s1.clear( );
   cout << "The size of the set after clearing is " 
        << s1.size( ) << "." << endl;
}
  
  

요구 사항

헤더: <set>

네임 스페이스: std

참고 항목

참조

set Class

set::empty 및 set::clear

표준 템플릿 라이브러리