Udostępnij za pośrednictwem


deque::clear

Erases all the elements of a deque.

void clear( );

Example

// deque_clear.cpp
// compile with: /EHsc
#include <deque>
#include <iostream>

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

   cout << "The size of the deque is initially " << c1.size( ) << endl;
   c1.clear( );
   cout << "The size of the deque after clearing is " << c1.size( ) << endl;
}
The size of the deque is initially 3
The size of the deque after clearing is 0

Requirements

Header: <deque>

Namespace: std

See Also

Reference

deque Class

deque::erase and deque::clear

Standard Template Library

Other Resources

deque Class Members