STL list的erase实现

iterator erase(iterator position) {
    link_type next_node = link_type(position.node->next);
    link_type prev_node = link_type(position.node->prev);
    prev_node->next = next_node;
    next_node->prev = prev_node;
    destroy_node(position.node);
    return iterator(next_node);
}

 

iterator erase(iterator first, iterator last);
posted @ 2013-01-04 15:33  helloweworld  阅读(373)  评论(0编辑  收藏  举报