Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
Miscellaneous
STL Containers
bitset
deque
list
map
multimap
multiset
priority_queue
queue
set
stack
vector
multiset
comparison operators
multiset::multiset
multiset::~multiset
member functions:
multiset::begin
multiset::clear
multiset::count
multiset::empty
multiset::end
multiset::equal_range
multiset::erase
multiset::find
multiset::get_allocator
multiset::insert
multiset::key_comp
multiset::lower_bound
multiset::max_size
multiset::operator=
multiset::rbegin
multiset::rend
multiset::size
multiset::swap
multiset::upper_bound
multiset::value_comp


multiset::size

public member function
size_type size() const;

Return container size

Returns the number of elements in the container.

Parameters

none

Return Value

The number of elements that conform the multiset's content.

Member type size_type is an unsigned integral type.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// multiset::size
#include <iostream>
#include <set>
using namespace std;
int main ()
{
  multiset<int> myints;
  cout << "0. size: " << (int) myints.size() << endl;
  for (int i=0; i<10; i++) myints.insert(i);
  cout << "1. size: " << (int) myints.size() << endl;
  myints.insert (5);
  cout << "2. size: " << (int) myints.size() << endl;
  myints.erase (5);
  cout << "3. size: " << (int) myints.size() << endl;
  return 0;
}


Output:
0. size: 0
1. size: 10
2. size: 11
3. size: 9

Complexity

Constant.

See also