Guest User

Untitled

a guest
Nov 19th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. template<class T>
  2. class LinkedList
  3. {
  4. public:
  5. LinkedList(int capacity);
  6. ~LinkedList();
  7. const LinkedList& operator = (const LinkedList& right);
  8. LinkedList(const LinkedList& right);
  9.  
  10. class Iterator : public std::iterator<std::bidirectional_iterator_tag, T>
  11. {
  12. public:
  13. Iterator(const LinkedList<T> &obj, int index);
  14. T& operator*();
  15. Iterator& operator++();
  16. Iterator& operator--();
  17. int GetIndex() const { return _copyIndex; };
  18. int *GetNext() const { return _copyNext; };
  19.  
  20. private:
  21. int _copyIndex;
  22. int _copyPrevIndex;
  23. T *_copyItems;
  24. int *_copyNext;
  25. int *_copyPrev;
  26. };
  27.  
  28. Iterator Add(T value);
  29. Iterator Insert(Iterator it, T value);
  30.  
  31. private:
  32. T *_items;
  33. int *_next;
  34. int *_prev;
  35. int _index;
  36. int _prevIndex;
  37. int _deletedIndex;
  38. int _head;
  39. int _count;
  40. int _capacity;
  41. };
Add Comment
Please, Sign In to add comment