hash_map::clear
[!POZNÁMKA]
Toto rozhraní API je zastaralé.Alternativou je unordered_map – třída.
Vymaže všechny prvky hash_map.
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_map_clear.cpp
// compile with: /EHsc
#include <hash_map>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_map<int, int> hm1;
hash_map<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_map is initially "
<< i << "." << endl;
hm1.clear();
i = hm1.size();
cout << "The size of the hash_map after clearing is "
<< i << "." << endl;
}
Požadavky
Hlavička: <hash_map>
Obor názvů: stdext