Share via


multiset::size

Returns the number of elements in the multiset.

size_type size( ) const;

Return Value

The current length of the multiset.

Example

// multiset_size.cpp
// compile with: /EHsc
#include <set>
#include <iostream>

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

   ms1.insert( 2 );
   i = ms1.size( );
   cout << "The multiset length is now " << i << "." << endl;
}
The multiset length is 1.
The multiset length is now 2.

Requirements

Header: <set>

Namespace: std

See Also

Reference

multiset Class

Standard Template Library