标签:temp name logs names space head col int ret
#include <iostream> using namespace std; class ListHead{ public: ListHead *prev,*next; }; class List{ public: ListHead *head; List() { head = new ListHead(); head->prev = head; head->next = head; } ~List() { delete head; head = NULL; } void _listAdd(ListHead *toAdd,ListHead*prev,ListHead *next) { next->prev = toAdd; toAdd->next = next; toAdd->prev = prev; prev->next = toAdd; } void listAdd(ListHead *toAdd) { _listAdd(toAdd,head,head->next); } void listAddTail(ListHead *toAdd) { _listAdd(toAdd,head->prev,head); } void _listDelete(ListHead*prev,ListHead *next) { prev->next = next; next->prev = prev; } void listDelete(ListHead *entry) { _listDelete(entry->prev,entry->next); entry->prev = NULL; entry->next = NULL; } int listEmpty() { return head->next == head; } };
标签:temp name logs names space head col int ret
原文地址:http://www.cnblogs.com/xiaoyu-10201/p/7580138.html