Horje
size of unordered_set Code Example
size of unordered_set
// 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 << "\nThe elements are: ";
    for (auto it = arr1.begin(); it != arr1.end(); it++)
        cout << *it << " ";
  
    return 0;
}
size of unordered_set
// 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;
}




Cpp

Related
wgat is duble in c++ Code Example wgat is duble in c++ Code Example
1281. Subtract the Product and Sum of Digits of an Integer leetcode solution in c++ Code Example 1281. Subtract the Product and Sum of Digits of an Integer leetcode solution in c++ Code Example
cpp print variable value Code Example cpp print variable value Code Example
c++ how to check whether a file exists? Code Example c++ how to check whether a file exists? Code Example
exit: redefinition; '__declspec(noreturn)' or '[[noreturn]]' Code Example exit: redefinition; '__declspec(noreturn)' or '[[noreturn]]' Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
13