Last Updated : 04 Oct, 2018
The
size()method of
unordered_multisetis used to count the number of elements of unordered_set it is called with. It takes the number of elements in the container and counts the number of elements.
Syntax:size_type size() const;
where
size_typeis an unsigned integral type.
Return Value:This function returns the length of the controlled sequence or in short, it returns
the number of elements in the container. Below program illustrate the
unordered_multiset size()function :-
Example : CPP
#include <iostream>
#include <unordered_set>
using namespace std;
int main()
{
// Define the unordered_set
unordered_multiset<int> numbers{ 1, 2, 3, 4, 5, 6 };
// Calculate and print
// the size of the unordered_multiset
cout << "The container has "
<< numbers.size()
<< " elements in it";
}
Output:
The container has 6 elements in itComplexity :
It takes
constant(O(1))time of complexity to perform an operation.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4