Doubly Linked List class- Insert

Hi, I'm having some seg faults when I try to implement an Insert function with a doubly linked list class.

This is what I have so far:

template <class T>
typename List<T>::iterator List<T>::insert(iterator itr, const T& val)
{
Node *p = itr.current;
theSize++;
iterator itr2(p->next);
Node *node = new Node(val, p->prev, p);
p->prev->next = node;
p->prev = node;
return itr;
}


template <class T>
typename List<T>::iterator List<T>::insert(iterator itr, T && val)
{
Node *p = itr.current;
theSize++;
iterator itr2(p->next);
Node *node = new Node(val, p->prev, p);
p->prev->next = node;
p->prev = node;
return itr;
}

Any advice would be appreciated thanks!
http://www.cplusplus.com/forum/general/112111/


┬┐what's the difference between those two functions?
Topic archived. No new replies allowed.