4 ms·
Rust's lifetime tracking system is not implemented with smart pointers, although it does facilitate some very smart reference constructs indeed.
by oldmanjay 11y ago
Rust's lifetime tracking system is not implemented with smart pointers, although it does facilitate some very smart reference constructs indeed.
- steveklabnik 11y agoTo elaborate a bit, references are "smart pointers" in the sense that they have extra semantics on top of regular pointers, but they also aren't like what most people refer to as smart pointers. Rust's &T (references) are entirely checked at compile time, and generate the exact same code as a regular old C pointer would. No wrappers, extra allocations, reference counts, move/copy/whatever constructors (not that Rust even has those, but are important for C++ smart pointers).