3 ms·
> How would unsafe code help? Unsafe code doesn't suddenly give you move constructors does it? Unsafe code lets you store parent pointers as raw pointers and u
by Manishearth 9y ago
> How would unsafe code help? Unsafe code doesn't suddenly give you move constructors does it?
Unsafe code lets you store parent pointers as raw pointers and update them manually when you move things. You don't actually _want_ a move constructor here; your btree values are on the heap anyway; what you want is a .move() method that chains correctly, and you can write this in Rust. In C++ the move constructor is a convenient way of doing this but not the only way.
Move constructors are how you organize the code in C++. Rust will not support the same code organization. This does not mean it's not doable in Rust, just that you have to design it differently. Rust is not C++; this is ok.
- deleted 9y ago[deleted]