I was trying to understand what the rule of zero says by reading one of the blog http://ift.tt/1VMMjDY and if i am correct it says if you declare your own Dtor then don't forget to make the rest two move ctor/move assignment as default.
Example:from http://ift.tt/1LAUJTJ
class Widget {
public:
~Widget(); // temporary destructor
... // no copy or move functions
};
"The addition of the destructor has the side effect of disabling generation of the move functions, but because Widget is copyable, all the code that used to generate moves will now generate copies. In other words, adding a destructor to the class has caused presumably-efficient moves to be silently replaced with presumably-less-efficient copies".
The above text by Scott inside the quotes raise some questions in my mind why declaring Dtor hide move semantics??is declaring/definig Dtor only hide the move semantics or copy ctor/copy assignment as well hide the move semantics?
Aucun commentaire:
Enregistrer un commentaire