Sdílet prostřednictvím


set::clear

Vymaže všechny prvky množiny.

void clear( );

Příklad

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

Požadavky

Hlavička: <set>

Obor názvů: std

Viz také

Referenční dokumentace

set – třída

set::empty a set::clear

Standardní knihovna šablon