This is part 2.  My problems are with too any pointers and with long body code in the following functions:  void push_back(T_ data);void push_front(T_ data);T_ pop_back();T_ pop_front();void insert(iterator_t& i, T_ data);void erase(iterator_t& i);T_ front();T_ back();void print();void clear();private:    Node*  _head;    Node*  _tail;    int    _size;public:    typedef LinkedList<T_> list_t;    typedef Node      node_t;    typedef list_t*  listPtr;    typedef node_t*  node_ptr_t;    typedef LinkedListIterator iterator_t;    LinkedList() : _head( nullptr ), _tail( nullptr ), _size( 0 ) {}    LinkedList( LinkedList && list ) {        // Rvalue move ctor        _head = std::move(list._head);        _tail = std::move(list._tail);        _size = std::move(list._size);    }    ~LinkedList() {        // dtor deletes all of the node ptrs in the list        // very important to avoid memory leaks        while(_head)        {            node_ptr_t tmpNode(_head);            _head = _head->next;            delete tmpNode;        }    }    LinkedList& operator = ( LinkedList && list ) { // Rvalue = operator        _head = std::move(list._head);        _tail = std::move(list._tail);        _size = std::move(list._size);        return *this;    }    bool empty() const { return ( !_head || !_tail ); }    operator bool() const { return !empty(); }    node_ptr_t head() { return _head; }    node_ptr_t tail() { return _tail; }    int size() { return _size; }    iterator_t begin() { return iterator_t(_head); }    iterator_t end() { iterator_t i(_head); while(i != nullptr) ++i; return i; }    void push_back(T_ data){        _tail = new node_t(data, _tail, nullptr);        if( _tail->prev )            _tail->prev->next = _tail;        if( empty() )            _head = _tail;        ++_size;    }    void push_front(T_ data)    {        _head = new node_t(data, nullptr, _head);        if( _head->next )            _head->next->prev = _head;        if( empty() )            _tail = _head;        ++_size;    }    T_ pop_back(){        assert( !empty() );        node_ptr_t tmpNode(_tail);        T_ result = _tail->data;        if(_tail->prev)            _tail = _tail->prev;        else            _tail = _head;        _tail ? _tail->next=nullptr : _head=nullptr;        --_size;        delete tmpNode;        return result;    }    T_ pop_front(){        assert( !empty() );        node_ptr_t tmpNode(_head);        T_ result = _head->data;        if(_head->next)            _head = _head->next;        else            _head = _tail;        _head ? _head->prev=nullptr : _tail=nullptr;        --_size;        delete tmpNode;        return result;    }    void insert(iterator_t& i, T_ data){        node_ptr_t tmpNode = new node_t(data, i.getNode()->prev, i.getNode());        if(i.getNode()->prev)            i.getNode()->prev->next = tmpNode;        i.getNode()->prev = tmpNode;        if(i.getNode() == _head)            _head = i.getNode()->prev;        i = iterator_t(tmpNode);        ++_size;    }    void erase(iterator_t& i)   {        node_ptr_t tmpNode = i.getNode();        if(i.getNode() == _head) {            _head = i.getNode()->next;        }        if(i.getNode() == _tail) {            _tail = i.getNode()->prev;        }        if( i.getNode()->next )            i = iterator_t( i.getNode()->next );        else if( i.getNode()->prev)            i = iterator_t( i.getNode()->prev );        if(tmpNode->prev)            tmpNode->prev->next = tmpNode->next;        else            tmpNode->prev = nullptr;        if(tmpNode->next)            tmpNode->next->prev = tmpNode->prev;        else            tmpNode->prev = nullptr;        delete tmpNode;        --_size;        //node_ptr_t newTail = (tail == i.getNode()->prev ) ? i.getNode()->prev : tail;        //tail = newtail;        //--_size;        //delete i.Node    }    T_ front(){        return _head->data;    }    T_ back(){        return _tail->data;    }    void print();    void clear(){        while(_head)        {            node_ptr_t tmpNode(_head);            _head = _head->next;            delete tmpNode;        }    }};
Optimising LinkedList class - Part 2
c++;c++11;linked list;pointers