| ▲ | knorker 11 hours ago | ||||||||||||||||
After moving a value, it needs to remain in a "valid but unspecified state". How do you mean accessing a valid object is UB? | |||||||||||||||||
| ▲ | masklinn 9 hours ago | parent | next [-] | ||||||||||||||||
"Validity" is an extremely low bar in C++, it just means operations with no preconditions are legal, which in the most general case may be limited to destruction (because non-destructive moves means destruction must always be possible). | |||||||||||||||||
| ▲ | drysine 11 hours ago | parent | prev [-] | ||||||||||||||||
>After moving a value, it needs to remain in a "valid but unspecified state". No, it doesn't. The standard library requires that for its classes, but not the language. "Unless otherwise specified, such moved-from objects shall be placed in a valid but unspecified state."[0] [0] https://timsong-cpp.github.io/cppwp/n4950/lib.types.movedfro... | |||||||||||||||||
| |||||||||||||||||