multiset::clear
清除多重集的所有項目。
void clear( );
範例
// multiset_clear.cpp
// compile with: /EHsc
#include <set>
#include <iostream>
int main( )
{
using namespace std;
multiset <int> ms1;
ms1.insert( 1 );
ms1.insert( 2 );
cout << "The size of the multiset is initially "
<< ms1.size( ) << "." << endl;
ms1.clear( );
cout << "The size of the multiset after clearing is "
<< ms1.size( ) << "." << endl;
}
需求
標題: <set>
命名空間: std