Created
September 2, 2013 04:37
-
-
Save wallstop/6409245 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> | |
LinkedList<T>::LinkedList() | |
{ | |
head = new node; | |
tail = new node; | |
head->prev = 0; //This can also be null, same thing. | |
head->next = tail; | |
tail->next = 0; | |
tail->prev = head; | |
// From here on out, you keep everything in between head and tail, | |
// and never change what head and tail point to. This is useful for | |
// iterating, as you can check when you've reached the beginning / | |
// end of the list, because you always know where those places are! | |
// (head and tail, respectively) | |
current = NULL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment