In C++11, declaring a user-defined destructor, copy constructor or copy assignment operator suppresses which implicitly generated members?
Correct answer
B. The move constructor and move assignment operator
14 views
B. The move constructor and move assignment operator
14 views
Rule of five: declaring any of the destructor, copy constructor or copy assignment operator prevents generation of the move constructor and move assignment operator, so copies silently take over and performance degrades. Such types stay copyable but not movable unless the moves are explicitly defaulted. Types that manage resources should therefore declare all five members deliberately.
Asked in: NTS, PPSC IT, Campus Interviews
Not sure why the answer is B? Ask here and get an explanation.