| 引用类型 | Rust | C++ |
|---|---|---|
| 普通引用 | &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> |
Rust智能指针类型
本作品采用 知识共享署名 4.0 国际许可协议 进行许可。
转载时请注明原文链接:https://blog.hufeifei.cn/2024/07/Rust/Rust-Smart-Pointer/
鼓励一下
| 支付宝 | 微信 |
|---|---|
![]() | ![]() |

