I'm implementing a move constructor and need to initialize other back to it's original state, as implemented in the default constructor. Is this possible or do I need to duplicate the code?
class Class
{
Class() { /* code to duplicate */ }
Class(Class&& other) :
mMember(other.mMember) {
other.Class(); // code to duplicate?
}
};
I know other.Class() is invalid here and I know that constructors can call each other with C++11 now.
Aucun commentaire:
Enregistrer un commentaire