← Back to context

Comment by tialaramex

6 hours ago

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n13...

"There is significant desire among C++ programmers for what we call destructive move semantics [...]"

"In the end, we simply gave up on this as too much pain for not enough gain."

groan

> When dealing with class hierarchies, destructive move semantics becomes problematic. If you move the base first, then the source has a constructed derived part and a destructed base part. If you move the derived part first then the target has a constructed derived part and a not-yet-constructed base part. Neither option seems viable. Several solutions to this dilemma have been explored.

Add this to my "C++ chose the wrong kind of polymorphism to make first-class" tally.

  • > Add this to my "C++ chose the wrong kind of polymorphism to make first-class" tally.

    Is it really the "wrong kind of polymorphism" if it isn't causing any problem and it didn't prevented rolling out features such as semantic support for move constructors?