// C++ program to illustrate the
// unordered_set.size() function
#include <iostream>
#include <unordered_set>
using namespace std;
int main()
{
unordered_set<int> arr1 = { 1, 2, 3, 4, 5 };
// prints the size of arr1
cout << "size of arr1:" << arr1.size();
// prints the element
cout << "
The elements are: ";
for (auto it = arr1.begin(); it != arr1.end(); it++)
cout << *it << " ";
return 0;
}
// C++ program to illustrate the
// unordered_set::size() function
// when container is empty
#include <iostream>
#include <unordered_set>
using namespace std;
int main()
{
unordered_set<int> arr2 = {};
// prints the size
cout << "Size of arr2 : " << arr2.size();
return 0;
}
Code Example |
---|
Cpp :: get function in cpp. |
Cpp :: c++ lambda as variable |
Cpp :: c++ map |
Cpp :: __builtin_popcount |
Cpp :: educative |
Cpp :: qt file explorer |
Cpp :: c++ string to char* |
Cpp :: concatenate string in cpp |
Cpp :: c++ function pointer as variable |
Cpp :: cpp custom exception |
Cpp :: memcpy in cpp |
Cpp :: javascript if else exercises |
Cpp :: c++ vector operations |
Cpp :: c++ structs |
Cpp :: Write a C++ program using constructor |
Cpp :: double plus overload |
Cpp :: vsearch c program stdlib |
Cpp :: why exceptions can lead to memory leaks |
Cpp :: Write a C++ program to Computing Mean and Median Using Arrays |
Cpp :: c++ friend keyword |
Cpp :: how to create windows warning message c++ |
Cpp :: c++ throe |
Cpp :: ++m in c |
Cpp :: find substring after character |
Cpp :: Z-function |
Cpp :: array di struct |
Cpp :: How to execute a command and get return code stdout and stderr of command in C++ |
Cpp :: a suprise... c++ |
Cpp :: c++ bind what are placeholders |
Cpp :: C++ selectin file location using Win32 API |