News for hackers. Stuff that matters.
Re:Why writing a linked list in safe Rust is so damned hard by pjmlp on Friday February 23, 2018 @01:55AM (#16444724)
I think the C++ example is safer modeled like this

    class ListNode {
        std::unique_ptr<ListNode> next;
        std::weak_ptr<ListNode> prev;
        // some data or whatever
      };
Re:Why writing a linked list in safe Rust is so damned hard by dbaupp on Friday February 23, 2018 @01:52PM (#16448391)
That doesn't work. std::weak_ptr is a reference counted pointer matched to std::shared_ptr; there's no concept of weak pointers (i.e. non-owning with dynamic checks) for std::unique_ptr, which corresponds almost exactly to Rust's Box.