0
編譯時我不斷收到此錯誤。我不確定模板構造函數是否有問題,或者我如何將類型'處理程序'插入到雙向鏈表中。構造函數必須顯式初始化沒有默認構造函數的成員
./ListNode.h:14:3: error: constructor for 'ListNode<Handler>' must explicitly
initialize the member 'data' which does not have a default constructor
ListNode(T d);
^
./doublyLinked.h:70:25: note: in instantiation of member function
'ListNode<Handler>::ListNode' requested here
ListNode<T> *node= new ListNode<T>(d);
^
simulation.cpp:56:20: note: in instantiation of member function
'DoublyLinkedList<Handler>::insertBack' requested here
handlerList->insertBack(*handler);
^
./ListNode.h:9:5: note: member is declared here
T data;
^
./handler.h:4:7: note: 'Handler' declared here
class Handler
^
繼承人的github上這裏爲完整的代碼 - > https://github.com/Cristianooo/Registrar-Simulator