The ‘=’ is an operator in C++ STL which copies (or moves) an unordered_set to another unordered_set and unordered_set::operator= is the corresponding operator function. There are three versions of this function.
- The first version takes reference of an unordered_set as an argument and copies it to an unordered_set.
- The second version performs a move assignment i.e it moves the content of an unordered_set to another unordered_set.
- The third version assigns contents of an initializer list to an unordered_set.
uset.operator= ( unordered_set& us ) uset.operator= ( unordered_set&& us ) uset.operator= ( initializer list )
- The first version takes the reference of an unordered_set as argument.
- The second version takes the r-value reference of an unordered_set as argument.
- The third version takes an initializer list as argument.
Return value: All of them returns the value of this pointer(*this) .
Below program illustrates the unordered_set::operator= in C++.
10 11 12 7 8 9 12 11 10 9 10 11 12 7 8 9
- Why overriding both the global new operator and the class-specific operator is not ambiguous?
- Operator Overloading '<<' and '>>' operator in a linked list class
- Ternary operator vs Null coalescing operator in PHP
- dot (.) operator in C/C++
- set operator= in C++ STL
- 'AND' vs '&&' as operator in PHP
- map::operator in C++ STL
- new vs operator new in C++
- map operator= in C++ STL
- unordered_multiset operator = in C++ STL
- alignof operator in C++
- bitset operator in C++ STL
- array::operator[ ] in C++ STL
- multiset::operator= in C++ STL
- multimap::operator= in C++ STL
Improved By : ankit15697