4 ms·
> So for example in Rust, you are absolutely welcome to move an immutable object. In Rust, your code won't even compile if you try to use a moved-from value. I
by kaashif 5y ago
> So for example in Rust, you are absolutely welcome to move an immutable object.
In Rust, your code won't even compile if you try to use a moved-from value. In C++ what happens depends on what the moved-from state looks like.
In C++, if you do something like use a moved-from value, it's really not obvious what "should" happen at all. It's not even obvious whether that should compile or be undefined behaviour.
> I absolutely sympathize with anyone who doesn't feel like knowing all these C++isms.
Any C++ programmer should agree with this. We don't want to know all of this bullshit and in fact would largely prefer if the compiler would know it for us...