The ‘==’ is an operator in C++ STL performs equality comparison operation between two unordered sets and unordered_set::operator== is the corresponding operator function for the same.
(unordered_set &uset1 == unordered_set &uset2)
Parameters: This operator function takes reference of two unordered sets uset1 and uset2 as parameters which are to be compared.
Return Value: This method returns a boolean result value after comparing the two sets. The comparison procedure is as follows:
- Firstly their sizes are compared .
- Then each element in ust1 is looked for in ust2
If both the conditions are satisfied true value is returned and at any point if a condition is not satisfied, false value is returned.
Below program illustrates unordered_set::operator== in C++.
sample1 and sample2 are equal. sample2 and sample3 are not equal.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- vector::operator= and vector::operator[ ] in C++ STL
- deque::operator= and deque::operator in C++ STL
- Ternary operator vs Null coalescing operator in PHP
- Why overriding both the global new operator and the class-specific operator is not ambiguous?
- array::operator[ ] in C++ STL
- list::operator= in C++ STL
- forward_list::operator= in C++ STL
- map::operator in C++ STL
- multiset::operator= in C++ STL
- multimap::operator= in C++ STL
- unordered_multiset operator = in C++ STL
- bitset operator in C++ STL
- multimap operator = in C++ STL
- map operator= in C++ STL
- match_results operator in C++ STL
- unordered_set operator= in C++ STL
- set operator= in C++ STL
- unordered_set operator!= in C++ STL
- Inserting elements in std::map (insert, emplace and operator )
- std::string::append vs std::string::push_back() vs Operator += in C++
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.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.