Rust智能指针类型

引用类型RustC++
普通引用&T
独享引用Box<T>std::unique_ptr
共享引用(引用计数)Rc<T>std::shared_ptr<const T>
共享可变引用Rc<RefCell<T>>std::shared_ptr<T>
多线程共享引用Arc<T>
弱引用Weak<T>std::weak_ptr<T>

本作品采用 知识共享署名 4.0 国际许可协议 进行许可。

转载时请注明原文链接:https://blog.hufeifei.cn/2024/07/Rust/Rust-Smart-Pointer/

鼓励一下
支付宝微信