hash_set::size
Note
This API is obsolete. The alternative is unordered_set Class.
Returns the number of elements in the hash_set.
size_type size( ) const;
Return Value
The current length of the hash_set.
Remarks
In Visual C++ .NET 2003, members of the <hash_map> and <hash_set> header files are no longer in the std namespace, but rather have been moved into the stdext namespace. See The stdext Namespace for more information.
Example
// 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;
}
The hash_set length is 1. The hash_set length is now 2.
Requirements
Header: <hash_set>
Namespace: stdext