3 ms·
But they are equivalent to smart pointers in Rust. For example even in Rust using std::sync::Arc can result in memory leaks just like in C++ with std::shared_pt
by jhasse 10y ago
But they are equivalent to smart pointers in Rust. For example even in Rust using std::sync::Arc can result in memory leaks just like in C++ with std::shared_ptr.
- steveklabnik 10y agoThey're not equivalent, though they are similar. For example, Rust is able to have the Rc/Arc split, allowing for increased performance in single-threaded code. You can't do that with shared_ptr, or at least, not in a way that's checked like in Rust.
- naasking 10y agoThey are not equivalent. For one, the Rust compiler checks that the references are properly initialized, passed around and dropped. C++ makes no such guarantees.