Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- T del(int index) {
- cout << "del " << index;
- if (index < 0 || index >= qsize)
- return NULL;
- cout << " qsize: " << qsize << "\n";
- if (index == 0) {
- Node* del_edition = start;
- start = start->next;
- T* result = del_edition->el;
- delete del_edition;
- qsize--;
- return *result;
- }
- int i = 0;
- Node* tmp = start;
- while (i++ < index-1) {
- tmp = tmp->next;
- }
- Node* del_edition = tmp->next;
- T* result = del_edition->el;
- tmp->next = tmp->next->next;
- delete del_edition;
- qsize--;
- return *result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement