hash_set::value_type
[!NOTA]
Questo API è obsoleto.L'alternativa consiste unordered_set Class.
Un tipo che descrive un oggetto archiviato come elemento di un hash_set la capacità come valore.
typedef Key value_type;
Commento
value_type è sinonimo del parametro di template Key.
Si noti che sia key_type che value_type sono sinonimi per il parametro di template Chiave.Entrambi i tipi sono forniti per le classi di hash_set quindi su, in cui sono identici, per compatibilità con le classi di multimap e il mapping, in cui sono diversi.
Per ulteriori informazioni su Key, vedere la sezione relativa alle osservazioni dell'argomento hash_set Class.
In Visual C++ .NET 2003, i membri dei file di intestazione <hash_set> e <hash_map> non sono più nello spazio dei nomi di deviazione standard, ma sono stati spostati nello spazio dei nomi di stdext.Per ulteriori informazioni, vedere lo spazio dei nomi stdext.
Esempio
// hash_set_value_type.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_set <int> hs1;
hash_set <int>::iterator hs1_Iter;
hash_set <int> :: value_type hsvt_Int; // Declare value_type
hsvt_Int = 10; // Initialize value_type
hash_set <int> :: key_type hskt_Int; // Declare key_type
hskt_Int = 20; // Initialize key_type
hs1.insert( hsvt_Int ); // Insert value into hs1
hs1.insert( hskt_Int ); // Insert key into hs1
// A hash_set accepts key_types or value_types as elements
cout << "The hash_set has elements:";
for ( hs1_Iter = hs1.begin( ) ; hs1_Iter != hs1.end( ); hs1_Iter++)
cout << " " << *hs1_Iter;
cout << "." << endl;
}
Requisiti
intestazione: <hash_set>
Stdext diSpazio dei nomi: