empty(): This function is available in the File: unordered_set.h
Syntax:
bool std::unordered_set<int>::empty() const
This functions returns true if the unordered_set is empty (i.e the size of unordered_set is 0).
Parameters: NA
Returns: true if the container size is 0, false otherwise.
File: unordered_set.h
For Example:
unordered_set<int> st = {4, 6, 10, 2}
st.empty() = > It returns 0 (because the unordered_set is not empty).
Approach
C++
#include <bits/stdc++.h>using namespace std;int main(){unordered_set<int> st = {4, 6, 10, 2};cout << st.empty() << "\n";return 0;}
Output:
0
No comments:
Post a Comment