Yep! If you look at the Rust Arc/Rc source here you'll see they have the same memory representation.
However, the fix is a little bit less errorprone to write. You simply need to do Rc<Box<WhateverStruct>>
Rc<Box<WhateverStruct>>
ech... and people say that C++ is a complex language :) Rust also looks scary :) Thanks for sharing
Ha that's a direct link to the source (and that was just to show you the memory layout).
Here's a much more user-friendly view into the non-thread-safe version of shared_ptr (the thread safe version is called Arc):
Arc
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Yep! If you look at the Rust Arc/Rc source here you'll see they have the same memory representation.
However, the fix is a little bit less errorprone to write. You simply need to do
Rc<Box<WhateverStruct>>
ech... and people say that C++ is a complex language :)
Rust also looks scary :)
Thanks for sharing
Ha that's a direct link to the source (and that was just to show you the memory layout).
Here's a much more user-friendly view into the non-thread-safe version of shared_ptr (the thread safe version is called
Arc
):