c++ - Implementing a template Linked List class using arrow (->) -
I have a problem with implementing a template linked list class. I have created previously linked lists, but the form of a template Not in
In the .CP file (implementation) it seems that members are not recognized as indicator variables and (Anyone who is a stranger is nothing that can get under syntax error.) I doubt there is something wrong in my visual express 2010, but I'm not sure When you use templated classes / functions, you must have a complete implementation in the source file. Keep all template references as the first trick for the first HI file;) If you want to keep your header clean without the function code, you can use - & gt; These pointers do not work after using . There is no drawing of syntax error anywhere near this issue, but when I highlight the variable, the details are "unknown" and the description of the variable
// list linked .h #include & lt; Iostream & gt; using namespace std; Template & lt; typename DataType & gt; Class list {private: structure list node {datatype datatum; ListNode * Next; }; ListNode * head; ListNode * Cursor; Public: list (underlying = 0); List (const list and others); In the list & amp; Operator = (const list and other); ~ List (); Enter zero (constant datatype and newditim); Zero removal (); In place of zero (constant datatype and newditum); Zero clear (); Boole is empty () Const; Bull is full () CONST; Zero götbugging (); Zero goto (); Bull Goto Next (); Bull Guy Prior (); Zero Shows Structure () CONST; Datatype receives casserole (); }; //ListLinked.cpp (the simplest of many member functions - the experiment - & gt;) template & lt; typename DataType & gt; Bull list & lt; DataType & gt; :: gotoNext () {If (cursor-> next! = Null) // "next" a member pointer variable is not seen as cursor = cursor->; next; } // All other member works // templates & lt; typename DataType & gt; // [type] list & lt; DataType & gt; :: {}
linkedlist.impl And put your definition in the end of your header, before your guard, add
#include "linkedlist.impl" .
Comments
Post a Comment