次の方法で共有


hash_multimap::clear

[!メモ]

この API は、互換性のために残されています。代わりに unordered_multimap クラスです。

hash_multimapのすべての要素を消去します。

void clear( );

解説

Visual C++ .NET 2003では、<hash_map><hash_set> ヘッダー ファイルのメンバーはstdの名前空間に存在しなくなりましたが、ではなくstdextの名前空間に型。詳細については、「The stdext Namespace」を参照してください。

使用例

/Wp64 フラグを持つまたは64ビット プラットフォームでこの例をコンパイルすると、コンパイラの警告C4267エラーが生成されます。この警告の詳細については、コンパイラの警告 (レベル 3) C4267を参照してください。

// hash_multimap_clear.cpp
// compile with: /EHsc
#include <hash_map>
#include <iostream>

int main()
{
    using namespace std;
    using namespace stdext;
    hash_multimap<int, int> hm1;
    hash_multimap<int, int>::size_type i;
    typedef pair<int, int> Int_Pair;

    hm1.insert(Int_Pair(1, 1));
    hm1.insert(Int_Pair(2, 4));

    i = hm1.size();
    cout << "The size of the hash_multimap is initially "
         << i  << "." << endl;

    hm1.clear();
    i = hm1.size();
    cout << "The size of the hash_multimap after clearing is "
         << i << "." << endl;
}
  
  

必要条件

ヘッダー: <hash_map>

名前空間: のstdext

参照

関連項目

hash_multimap Class

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