VonTum@programming.devtoC++@programming.dev•The move constructor that you have to declare, even though you don't want anyone to actually call it - The Old New Thing
2·
1 year agoTrue, though here the hack is incredibly unintuitive for the programmer. You have to declare the constructor, but then leave it unimplemented. Not to mention the compiler error that should catch this now only occurs at link time, and linking errors are even more cryptic to grok.
When they made RVO mandatory, they should’ve removed the constructor declaration requirement as well, instead of a half-ass solution like this.
As a final nail in the coffin, std::is_move_constructible<> suddenly returns true for this non-move-constructible type 😉
I actually like this, at least in some way it could lower the barrier for actually explaining what a function does. Though I don’t see this working in an office environment