I wonder if it is possible to call the move assignment operator without using the standard library std::move.
So for example if I call :
class A {
private:
char* data;
public:
// move constructor
A(A&& other) : data(other.data) {
// we steal the pointer!
other.data = NULL;
}
// move operator=
A& operator=(A&& other) {
if (this != &other) {
delete data;
data = other.data;
data.foo = NULL;
}
return *this;
}
};
int main(){
A objA;
A objB;
objB = std::move(objA);
}
can I now write something other than objB = std::move(objA);
?
Aucun commentaire:
Enregistrer un commentaire