dimanche 28 juillet 2019

Do we need to set move constructor = default? For legacy classes with user declared destructor buildet with C++98/03 in the past?

So the question is, lets consider a big legacy project in c++ in the past always build for C++98/03 standard.

And the project followed the rule of three, so therefore there are a lot of user defined destructors in the project.

If now the project is build for standard C++11/14/17, is it a good idea to set the move constructor = default manually?

Because due to the slide shown by Howard Hinnant at Accu_2014 these classes are not automatically provided with an move constructor. ACCU2014 Howard Hinnant, Special Members

So the question is could the project benefit in performance by setting the move constructor = default for every class?

And to be more precise, lets say after setting the move constructor = default the application runs exactly as before and all unit test work as before.

Do you think there will be a performance benefit by defining the move constructor = default?

Thanx

Aucun commentaire:

Enregistrer un commentaire