multimap::size
Returns the number of elements in the multimap.
size_type size( ) const;
Return Value
The current length of the multimap.
Example
When compiling this example with the /Wp64 flag or on a 64-bit platform, compiler warning C4267 will be generated. For more information on this warning, see Compiler Warning (level 3) C4267.
// multimap_size.cpp
// compile with: /EHsc
#include <map>
#include <iostream>
int main()
{
using namespace std;
multimap<int, int> m1, m2;
multimap<int, int>::size_type i;
typedef pair<int, int> Int_Pair;
m1.insert(Int_Pair(1, 1));
i = m1.size();
cout << "The multimap length is " << i << "." << endl;
m1.insert(Int_Pair(2, 4));
i = m1.size();
cout << "The multimap length is now " << i << "." << endl;
}
The multimap length is 1.
The multimap length is now 2.
Requirements
Header: <map>
Namespace: std