title: Making a Queue Push_Back and Pop_Front with a Linked List
body: <p>So I'm trying to create a Queue with a Linked List but I'm having trouble with my insert (which acts as push_back) and my erase (which acts as pop_front) apparently the insert and erase doesn't want to work they they are supposed to.</p>
  
  <pre><code>    #ifndef LINKEDLIST_H
      #define LINKEDLIST_H
  
      using namespace std;
  
      template &lt;class T&gt;
          struct Node {
                  T value;
                  Node&lt;T&gt; *next;
                  Node&lt;T&gt; *prev;
                  Node() : value(T()), next(NULL), prev(NULL) {}
                  Node(T v) : value(v), next(NULL), prev(NULL) {}
                  T getValue() { return value; }
                  void setValue(T v) { value = v; }
          };
  
      template &lt;class T&gt;
          class LinkedList {
              private:
                  Node&lt;T&gt; *header;
              public:
                  LinkedList() {
              header = new Node&lt;T&gt;();
              header-&gt;next = header;
              header-&gt;prev = header;
          }
          ~LinkedList() {
              while (header-&gt;next != header-&gt;next)
                 delete header;
          }
  
          void insert(T n) {
              Node&lt;T&gt; *newNode = new Node&lt;T&gt;(n);
              newNode-&gt;prev = header;
              newNode-&gt;next = header-&gt;next;
              newNode-&gt;next-&gt;prev = newNode;
              header-&gt;next = newNode;
          }
  
          void erase() {
              header-&gt;next-&gt;prev-&gt;next = header-&gt;next-&gt;next;
              header-&gt;next-&gt;next-&gt;prev = header-&gt;next-&gt;prev;
              delete header-&gt;next;
          }
  
          Node&lt;T&gt; *begin() { return header-&gt;next; }
          Node&lt;T&gt; *end() { return header; }
      };
      #endif // LINKEDLIST_H
  </code></pre>