次の方法で共有


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

参照

関連項目

hash_set Class

標準テンプレート ライブラリ