(Why) should a move constructor or move assignment operator clear its argument?
问题 An example move constructor implementation from a C++ course I’m taking looks a bit like this: /// Move constructor Motorcycle::Motorcycle(Motorcycle&& ori) : m_wheels(std::move(ori.m_wheels)), m_speed(ori.m_speed), m_direction(ori.m_direction) { ori.m_wheels = array<Wheel, 2>(); ori.m_speed = 0.0; ori.m_direction = 0.0; } ( m_wheels is a member of type std::array<Wheel, 2> , and Wheel only contains a double m_speed and a bool m_rotating . In the Motorcycle class, m_speed and m_direction are