The ‘=’ is an operator in C++ STL which copies (or moves) a set to another set and set::operator= is the corresponding operator function. There are three versions of this function:
- The first version takes reference of an set as an argument and copies it to an set.
Parameters: The first version takes the reference of an set as argument.
- The second version performs a move assignment i.e it moves the content of an set to another set.
Parameters: The second version takes the r-value reference of an set as argument
- The third version assigns contents of an initializer list to an set.
Parameters: The third version takes an initializer list as argument.
- 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
- map operator= in C++ STL
- map::operator in C++ STL
- new vs operator new in C++
- dot (.) operator in C/C++
- 'AND' vs '&&' as operator in PHP
- unordered_set operator= in C++ STL
- match_results operator in C++ STL
- unordered_multimap operator= in C++
- match_results operator= in C++
- unordered_map operator= in C++ STL
- forward_list::operator= in C++ STL
- multiset::operator= in C++ STL
Return Value: All of them return the value of this pointer(*this).
The following programs illustrates set::operator= :
1 2 3 4 5 6 7 8 1 6 7 8 1 2 3 4 5 6 7 8
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.