Condividi tramite


hash_set::size

[!NOTA]

Questo API è obsoleto.L'alternativa consiste unordered_set Class.

Restituisce il numero di elementi in hash_set.

size_type size( ) const;

Valore restituito

La lunghezza del hash_set.

Note

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_size.cpp
// compile with: /EHsc
#include <hash_set>
#include <iostream>

int main( )
{
   using namespace std;
   using namespace stdext;
   hash_set <int> hs1;
   hash_set <int> :: size_type i;
   
   hs1.insert( 1 );
   i = hs1.size( );
   cout << "The hash_set length is " << i << "." << endl;

   hs1.insert( 2 );
   i = hs1.size( );
   cout << "The hash_set length is now " << i << "." << endl;
}
  
  

Requisiti

intestazione: <hash_set>

Stdext diSpazio dei nomi:

Vedere anche

Riferimenti

hash_set Class

Libreria di modelli standard