Guest User

Untitled

a guest
Feb 21st, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. void sorted_type::remove(std::string uid) {
  2.     node_type *ph = NULL;
  3.     node_type *node_ptr = data;
  4.     if (node_ptr->info.get_uid() == uid) {
  5.         ph = node_ptr;
  6.         data = node_ptr->next;
  7.     }
  8.     while (node_ptr->next) {
  9.         if (node_ptr->next->info.get_uid() == uid) {
  10.             ph = node_ptr->next;
  11.             node_ptr->next = node_ptr->next->next ? node_ptr->next->next : NULL;
  12.             break;
  13.         }
  14.         node_ptr = node_ptr->next;
  15.     }
  16.     delete ph;
  17.     size--;
  18. }
Add Comment
Please, Sign In to add comment