Advertisement
Guest User

things of my hands

a guest
Mar 2nd, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. template <typename Type>
  2. Linked_stack<Type>::~Linked_stack() {
  3. Double_node<Type *> *ptr = list.head();
  4. //iterates through each node and destroys them
  5. while(ptr != list.tail()){
  6. Double_node<Type *> *del = ptr;
  7. ptr = ptr->next();
  8. delete[] del->retrieve();
  9. }
  10. delete[] list.tail();
  11. }
  12.  
  13.  
  14. --------------------------------------------------------
  15. template <typename Type>
  16. Double_sentinel_list<Type>::~Double_sentinel_list() {
  17. Double_node<Type> *ptr = head();
  18. //iterates through each node and destroys them
  19. while(ptr != nullptr){
  20. Double_node<Type> *del = ptr;
  21. ptr = ptr->next();
  22. delete del;
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement