2 ms·
If the structure is immutable after you've produced it, you can use extra::arc::Arc<T> [0], and once all the references are dropped the memory will be deallocat
by jmgrosen 13y ago
If the structure is immutable after you've produced it, you can use extra::arc::Arc<T> [0], and once all the references are dropped the memory will be deallocated. I haven't used C++, so this might be very similar to std::shared_ptr or not, but this is usually what one would use in Rust. (There's also extra::arc::RWArc<T> [1] when you need mutability, but that isn't used much in my experience.)
[0] http://static.rust-lang.org/doc/master/extra/arc/struct.Arc.html http://static.rust-lang.org/doc/master/extra/arc/struct.Arc....
[1] http://static.rust-lang.org/doc/master/extra/arc/struct.RWArc.html http://static.rust-lang.org/doc/master/extra/arc/struct.RWAr...