map::size |
public member function |
Return container size
Returns the number of elements in the container.
Parameters
none
Return Value
The number of elements that conform the
map's content.
Member type size_type is an unsigned integral type.
Example
// map::size
#include <iostream>
#include <map>
using namespace std;
int main ()
{
map<char,int> mymap;
mymap['a']=101;
mymap['b']=202;
mymap['c']=302;
cout << "mymap.size() is " << (int) mymap.size() << endl;
return 0;
}
|
Output:
Complexity
Constant.
See also
map::empty | Test whether container is empty (public member function) |