News for hackers. Stuff that matters.
Re:A static_cast is not always just a pointer adjustment by ant6n on Sunday April 03, 2016 @09:59AM (#11416114)
I thought moving will leave the original in some valid state. For example moving a vector may leave the original object as an empty vector. What's so broken about that?
Re:A static_cast is not always just a pointer adjustment by catnaroek on Sunday April 03, 2016 @10:33AM (#11416225)
Sometimes there is no valid state for a `std::move`d object, e.g. a `std::unique_ptr`.
Re:A static_cast is not always just a pointer adjustment by ant6n on Sunday April 03, 2016 @02:10PM (#11416978)
Wouldn't just be nullptr?
Re:A static_cast is not always just a pointer adjustment by catnaroek on Sunday April 03, 2016 @02:49PM (#11417118)
The very concept of a nullable pointer is problematic, because it means that every dereference operation is potentially unsafe.

The only satisfactory solution is to enforce, using the type system, the rule that moved objects can't be reused. Unfortunately, C++'s type system can't express this.