Re:Rust – Compile Time Memory Safety
by marcianx on Monday April 22, 2019 @10:47PM
(#19725174)
Yes, it's completely safe and its rust equivalent is
https://doc.rust-lang.org/std/mem/fn.replace.html
[ Parent
| on HN ]
There's no guarantee that std::move moves elements out of x. (and thus no guarantee that it's equivalent to a Rust mem::replace with a new Vec) The only requirement the C++ standard imposes is that the vector is left in a "valid but unspecified state".