r/rust • u/TheProgrammar89 • Jul 26 '19
Is this comment about the reference counting performance in Rust accurate?
/r/ProgrammerHumor/comments/b274zp/oof/eirvecs?context=3
48
Upvotes
r/rust • u/TheProgrammar89 • Jul 26 '19
View all comments
Show parent comment
5
u/simonask_ Jul 27 '19
I think an important point is that
std::unique_ptr<T>is actually likeOption<Box<T>>, andstd::shared_ptr<T>is actually likeOption<Arc<T>>.The fact that Rust supports non-nullable smart pointers is an important way in which it can reduce code complexity and risk. C++'s definition of move semantics makes this fundamentally impossible.