template<class T>
Node<T>* SAList<T>::search(const T& key, bool (*match)(const T&,const T&))
{
Node<T> *curr, *temp;
bool stop = false;
curr = head;
while(curr != NULL && stop != true){
if((*match)(curr->data_,key) == true){
temp = curr;
if(temp->prev_ != NULL) {
if(temp != NULL){
temp = temp->next_;
temp->prev_ = curr->prev_;
temp = temp->prev_;
temp->next_ = curr->next_;
/* curr->prev_ = NULL; // Commented this out for
head->prev_ = curr; // The moment until I figure
curr->next_ = head; */ // Out the problem
head = curr;
}
else{
temp = temp->prev_;
temp->next_ = NULL;
}
}
stop = true;
}
if(stop == false)
curr = curr->next_;
}
return curr;
}