fork download
  1. Iterator erase(Iterator position)
  2. {
  3. Iterator it = NULL;
  4. if (position->current->next)
  5. {
  6. it = position->current->next;
  7. position->current->next->prev = position->current->prev;
  8. }
  9. else if (position->current->prev)
  10. {
  11. position->current->prev->next = NULL;
  12. Tail = position->current->prev;
  13. }
  14. else
  15. Head = Tail = NULL;
  16. if (position->current->prev)
  17. position->cureent->prev->next = position->current->next;
  18. else if (position->current->next)
  19. {
  20. position->current->next->prev = NULL;
  21. Head = position->current->next;
  22. }
  23. else
  24. Head = Tail = NULL;
  25. delete position;
  26. if (it)
  27. return it;
  28. else
  29. cout << "This element is the last element\n";
  30. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:2: error: ‘Iterator’ does not name a type
  Iterator erase(Iterator position)
  ^~~~~~~~
stdout
Standard output is empty