Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 双链接列表的帮助?_C++_Templates_Data Structures - Fatal编程技术网

C++ 双链接列表的帮助?

C++ 双链接列表的帮助?,c++,templates,data-structures,C++,Templates,Data Structures,我有一个类LinkedList clas,它有一个名为Node的类 class Node { public: Node() { next = NULL; prev = NULL; } ~Node() {} public : Node *next; Node *prev; T data; }; 在同一个LinkedList类中,我有以下函数定义,因为它都在头文件中 public: LinkedList(); ~LinkedList(); // methods -- note that

我有一个类LinkedList clas,它有一个名为Node的类

class Node {
public:
Node() { next = NULL; prev = NULL; }
~Node() {}
public :
Node *next;
Node *prev;
T data;


 };
在同一个LinkedList类中,我有以下函数定义,因为它都在头文件中

 public:
LinkedList();
~LinkedList();

// methods -- note that the return values are of type T. Don't return a Node!
  void append(T item);
  T get(int idx);
  void insert(int idx, T item);
  void map(T (*pf)(T item));
  T remove(int index);
  int size();
  void unshift(T item);
不,我正在尝试执行这些操作

首先,我需要返回一个新的空链表

请帮忙,我试过很多东西

它会像这样简单吗

LinkedList<T>::LinkedList() {

head = NULL;
current = NULL;

}
LinkedList::LinkedList(){
head=NULL;
电流=零;
}

它会像这样简单吗

LinkedList<T>::LinkedList() {
    head = NULL;
    current = NULL;
}
LinkedList::LinkedList(){
head=NULL;
电流=零;
}

是的。

我们闻所未闻实际问题是什么,你知道……家庭作业?请添加一个标签。此外,空节点指针是一个空列表。如果你至少有一个节点,它就不再是空的。有那种家庭作业的味道。你干什么了。是否存在编译错误。所有这些信息都太棒了。我不是要你们帮我做这件事,我只是想要一些什么方面的帮助?我在你的帖子里没有看到问号。这不适用于当前设置,我是否必须添加一个private:Node*head,*current;在linkedlist构造函数中