News for hackers. Stuff that matters.
Re:Hardening the C++ Standard Library at scale by simonask on Sunday November 30, 2025 @06:55AM (#46095905)
I did not say “default-constructed”, because that’s a whole other can of worms.

But yes, the implication of C++ move semantics is that every movable object must also define an “empty” (moved-from) state, so you cannot have something like a never-null unique ptr.

Specifically, it is not allowed for the moved-from object to be inconsistent or to say “using it in any way is UB”, because its destructor will run.

There are no comments on this comment yet.