I know the move semantics in the C ++ move constructor, but here I have the confusion:
class Derived: public Base {
std::vector<int> vec;
std::string name;
public:
Derived(Derived&& x)
: Base(std::move(x)),
vec(std::move(x.vec)),
name(std::move(x.name)) { }
Derived& operator=(Derived&& x)
{
Base::operator=(std::move(x));
vec = std::move(x.vec);
name = std::move(x.name);
return *this;
}
};
the base of the move constructor (std :: move (x)), x were converted to an rvalue reference, like vec (std :: move (x.vec))? still x existing?
source
share