3 ms·
The classic thing that's tough to do is self-referential structures; since you have no hook into moves, you can't fix-up the references. It also has quite a fe
by steveklabnik 5y ago
The classic thing that's tough to do is self-referential structures; since you have no hook into moves, you can't fix-up the references.
It also has quite a few pros, and many people think it's better the way it is. Since moves are memcopies, they can never fail, meaning there's no opportunities for panics, which means it's much easier to optimize. They aren't arbitrarily expensive; you always know what the cost is. As you mentioned, there's no need for a "moved-from" state, which can save space and/or program logic.
- ncmncm 5y agoIt is correct to say that allowing move constructors to fail was a grave design mistake.