Sdílet prostřednictvím


hash_multimap::clear

[!POZNÁMKA]

Toto rozhraní API je zastaralé.Alternativou je unordered_multimap – třída.

Vymaže všechny prvky hash_multimap.

void clear( );

Poznámky

V aplikaci Visual C++ .NET 2003, členové hlavičkových souborů tříd <hash_map> a <hash_set> již nejsou v oboru názvů std, ale byly přesunuty do oboru názvů stdext.Další informace naleznete v tématu Obor názvů stdext.

Příklad

Při kompilaci v tomto příkladu se /Wp64 příznak, nebo na 64bitovou platformu se vygeneruje kompilátor upozornění C4267.Další informace o upozornění naleznete v tématu Upozornění kompilátoru (úroveň 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;
}
  

Požadavky

Hlavička: <hash_map>

Obor názvů: stdext

Viz také

Referenční dokumentace

hash_multimap – třída

Standardní knihovna šablon