I'm trying to build a function that is gonna transfer all elements from one list to another in deque class. For example, if you have list 1 {1,2,3} and list 2 {4,5}. What I am going to do is transfer all the elements inside list 2 into list 1, make it list 1 {1,2,3,4,5} (ordered is not required) and list 2 will be empty after that. However, the result list that I'm getting is not correct at all....Can anyone what's wrong with my code please ? Thank you
void meld(Deque<E>& other)
{
DNode<E>* a = _head;
DNode<E>* b = _tail;
DNode<E>* c = other.get_head();
DNode<E>* d = other.get_tail();
DNode<E>* temp = c;
b->set_next(temp);
temp->set_prev(b);
_size += other.size();
c = nullptr;
}