I have an object something like the following and I'm trying to implement a move constructor for so you can have an insert for std::vector<Mesh>.
struct Mesh
{
std::vector<Vector3> vPoint;
bool Valid;
Mesh(Mesh&& other)
{
vPoint = std::move(other.vPoint);
Valid = std::move(other.Valid);
}
};
Is this the correct way? And if so what is the value of other.Valid after std::move operates on it?
Edit:
Also if I have an instance of this object do I need to use std::move in the following scenario?
std::vector<Mesh> DoSomething()
{
Mesh mesh; //Imagine vPoint is filled here to
std::vector<Mesh> meshes;
meshes.push_back(std::move(mesh)); // Here is my question, std::move? or just pass mesh here?
return meshes;
}
moveabool?std::move<bool>or other integral types. Does it copy the value tothis.Validand then setother.Validto the default value of bool (aka false)?