Hacker News new | ask | show | jobs
by jjmarr 391 days ago
> which may be read after being moved-from (a valid behaviour in some systems code contexts)

std::move as applied to standard library types will leave the object in a "valid but unspecified state".[1] If you're leaving the object in an invalid state (one where the invariants are broken), you're not writing idiomatic C++.

[1] https://en.cppreference.com/w/cpp/utility/move.html

1 comments

I am using “invalid” here in the semantic sense of not containing a meaningful value. It is not invalid in a structural sense.