In the case of SuperObject copy and move constructors will be generated, as well as the corresponding copy and move operators. No other constructors will be generated. In order for the compiler to stop generating the copy constructor, it’s enough to write your own. It is even easier to prohibit the generation of relocation, just implement one of the following list:
- Copy Constructor
- Motion constructor
- Destructor
- Copy operator
- Move operator
But why such a difference with the copy constructor? Because the old code needs to be maintained. By the way, the above is not written the whole truth about the generation of the copy constructor, in the following cases it will be automatically generated as deleted ( = delete ) if the user added:
- Motion constructor
- Move operator
Thus, the standard almost equalizes two constructors, only the destructor cannot yet forbid the copy constructor - it would break a lot of code. But this is already declared as deprecated , so in the future, the copy constructor will not be generated if the class has a destructor or a copy operator (custom, I mean):
[depr.impldec]
If you are a user, you have been given a copyright or a copyright statement. If you are a user, you must be able to use a copyright code (12.4, 12.8). These could not be deleted (8.4).
About the 2 part of the question Abyx wrote already - it will be either NRVO, or the list will be moved. Items will not move.
c++11not so new. Currently relevantc++14. - αλεχολυτC++11not fully supported by everyone, and you shouldn’t talk aboutC++14;) - sys_dev