hash_set::clear
[!メモ]
この API は、互換性のために残されています。代わりに unordered_set クラスです。
hash_setのすべての要素を消去します。
void clear( );
解説
Visual C++ .NET 2003では、<hash_map> と <hash_set> ヘッダー ファイルのメンバーはstdの名前空間に存在しなくなりましたが、ではなくstdextの名前空間に型。詳細については、「The stdext Namespace」を参照してください。
使用例
// hash_set_clear.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_set <int> hs1;
hs1.insert( 1 );
hs1.insert( 2 );
cout << "The size of the hash_set is initially " << hs1.size( )
<< "." << endl;
hs1.clear( );
cout << "The size of the hash_set after clearing is "
<< hs1.size( ) << "." << endl;
}
必要条件
ヘッダー: <hash_set>
名前空間: のstdext