Sdílet prostřednictvím


vector::clear

Smaže prvky vektoru.

void clear( );

Příklad

// vector_clear.cpp
// compile with: /EHsc
#include <vector>
#include <iostream>

int main( )
{
   using namespace std;   
   vector <int> v1;
   
   v1.push_back( 10 );
   v1.push_back( 20 );
   v1.push_back( 30 );

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

Požadavky

Záhlaví: <vector>

Obor názvů: std

Viz také

Referenční dokumentace

vector Class

Standardní šablona knihovny