multimap size() function in C++ STL
The multimap::size() is a built-in function in C++ STL which returns the number of elements in the multimap container.
Syntax:
multimap_name.size()
Parameters: The function does not accept any parameter.
Return Value: This function returns the number of elements a multimap container has.
// C++ function for illustration // multimap::size() function #include <bits/stdc++.h> using namespace std; int main() { // initialize container multimap<int, int> mp; // insert elements in random order mp.insert({ 2, 30 }); mp.insert({ 1, 40 }); mp.insert({ 2, 60 }); mp.insert({ 2, 20 }); mp.insert({ 1, 50 }); mp.insert({ 4, 50 }); cout << "multimap mp has " << mp.size() << " number of elements"; return 0; } |
chevron_right
filter_none
Output:
multimap mp has 6 number of elements
Recommended Posts:
- multimap::crbegin() and multimap::crend() in C++ STL
- multimap::cbegin() and multimap::cend() in C++ STL
- multimap upper_bound() function in C++ STL
- multimap get_allocator() function in C++ STL
- multimap lower_bound() function in C++ STL
- multimap clear() function in C++ STL
- multimap value_comp() function in C++ STL
- multimap empty() function in C++ STL
- multimap swap() function in C++ STL
- multimap::begin() and multimap::end() in C++ STL
- unordered_multimap size() function in C++ STL
- valarray size() function in C++
- unordered_set size() function in C++ STL
- list size() function in C++ STL
- multimap::count() in C++ STL
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



