Skip to content

Node的insert函数是不是错了 #62

Description

@frsama
void insert(int val) {
    auto node = std::make_shared<Node>(val);
    node->next = next;
    node->prev = prev;
    if (prev)
        prev->next = node;
    if (next)
        next->prev = node;
}

在this节点处插入一个节点node(val),this的前驱改了,后继改了;
然而this节点没有做任何处理,消失在了虚空之中,或者说永远的留在了虚空之中。

还是说把它改正确也是作业的一部分,但是作业完全没提。
不过我看了一下,这个函数完全没用上。
image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions