DoubleLinkedList adding element doesn't work and somehow it always stays empty : <p>As I said before DoubleLinkedList always stays empty...</p>

<p>I have reread code. Firstly add utility seemed a bit suspicious but it looks correct for me. I have tried adding an element into the list but when I'm calling <em>empty()</em> function it always displays <em>True</em>. Given function seems right for me.</p>

<pre><code>template &lt;typename T&gt;
class DoubleLinkedList; // simple class declaration

template &lt;typename T&gt;
class Node { // double linked list node
private:
    T data; // node element value
    Node *next; // next node in list
    Node *previous; // previous node in list

    friend DoubleLinkedList&lt;T&gt;; // allow DoubleLinkedList access
};

template &lt;typename T&gt;
class DoubleLinkedList { // doubly linked list;
public:
    DoubleLinkedList(); // constructor
    ~DoubleLinkedList(); // destructor

    bool empty() const; // is list empty?
    const T&amp; front() const; // get front element
    const T&amp; back() const; // get back element
    void add_front(const T&amp; e); // add to front of list
    void add_back(const T&amp; e); // ad to back of list
    void remove_front(); // remove from front
    void remove_back(); // remove from back
    void ordered_traverse() const;

private: // local type definitions
    // list sentinels (dummy nodes)
    Node&lt;T&gt;* header;
    Node&lt;T&gt;* tailer;

protected: // local utilities
    void add(Node&lt;T&gt;* v, const T&amp; e); // insert new node before v
    void remove(Node&lt;T&gt;* v); // remove v node
};

template &lt;typename T&gt;
DoubleLinkedList&lt;T&gt;::DoubleLinkedList() { //constructor
    // create sentinels
    header = new Node&lt;T&gt;;
    tailer = new Node&lt;T&gt;;

    // have them point to each other
    header-&gt;next = tailer;
    tailer-&gt;previous = header;
}

template &lt;typename T&gt;
// destructor, removing all but sentinels; remove the sentinels
DoubleLinkedList&lt;T&gt;::~DoubleLinkedList() { while (!empty()) {remove_front(); delete header; delete tailer; }}

template &lt;typename T&gt;
void DoubleLinkedList&lt;T&gt;::ordered_traverse() const {
    Node&lt;T&gt;* cur = header-&gt;next;

    cout &lt;&lt; "Starting Traversing... \n";

    while (cur != tailer){
        cout &lt;&lt; cur-&gt;data &lt;&lt; endl;
    }
}

template &lt;typename T&gt;
// is list empty?
bool DoubleLinkedList&lt;T&gt;::empty() const { return header-&gt;next == tailer;}

template &lt;typename T&gt;
// get front element
const T&amp; DoubleLinkedList&lt;T&gt;::front() const { return header-&gt;next-&gt;data; }

template &lt;typename T&gt;
// get back element
const T&amp; DoubleLinkedList&lt;T&gt;::back() const { return tailer-&gt;previous-&gt;data; }

template &lt;typename T&gt;
// insert new node before v
void DoubleLinkedList&lt;T&gt;::add(Node&lt;T&gt; *v, const T &amp;e) {
    auto* u = new Node&lt;T&gt;; u-&gt;data = e; // create a new node for e
    // link new node to its appropriate place
    u-&gt;next = v;
    u-&gt;previous = v-&gt;previous;
    v-&gt;previous-&gt;next = v-&gt;previous = u;
}

template &lt;typename T&gt;
// add to front of list
void DoubleLinkedList&lt;T&gt;::add_front(const T &amp;e) { add(header-&gt;next, e);}

template &lt;typename T&gt;
// add to back of list
void DoubleLinkedList&lt;T&gt;::add_back(const T &amp;e) { add(tailer, e);}

template &lt;typename T&gt;
// remove node v
void DoubleLinkedList&lt;T&gt;::remove(Node&lt;T&gt; *v) {

    if (empty())
        throw std::out_of_range("Error: list is empty... \n");


    Node&lt;T&gt;* u = v-&gt;previous;
    Node&lt;T&gt;* w = v-&gt;next;

    u-&gt;next = w;
    w-&gt;previous = u;

    delete v;
}

template &lt;typename T&gt;
// remove from front
void DoubleLinkedList&lt;T&gt;::remove_front() { remove(header-&gt;next);}

template &lt;typename T&gt;
// remove from back
void DoubleLinkedList&lt;T&gt;::remove_back() { remove(tailer-&gt;previous);}
</code></pre>

<p>I need that adding method work the way it should and if you don't mind, please give me some advice about code's other flaws which I am not able to see because of my ignorance.</p>
