Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: