D
darrell.blake
I've just written a doubly linked list but when I tell the iterator to
move forward in the list it removes all the previous elements in the
list. i.e. If I were to do:
List list;
list.AddAtEnd(20);
list.AddAtEnd(30);
list.AddAtEnd(40);
list.AddAtBeginning(10);
Iterator iterator = list.GetIterator();
iterator.MoveToStart();
iterator.MoveForward();
I would expect to still get an output of 10, 20, 30, 40 when I cycle
through the list but it only outputs 20, 30 40. Similarly, if I were to
call MoveForward() one more time it would only output 30, 40.
Because of the size of the files I wont post the code here but I have
provided URLs to my LinkedList classes below:
http://www.dunmanifestin.co.uk/LinkedList.cpp
http://www.dunmanifestin.co.uk/LinkedList.h
I would be really grateful if someone could have a look at my files and
try and figure out what I'm doing wrong.
Thanks,
Darrell
p.s. The operator overloader that I've put in I can only seem to get to
work if I put everything in the header file. Is it possible to split it
up between the header and the source like all the other member
functions?
move forward in the list it removes all the previous elements in the
list. i.e. If I were to do:
List list;
list.AddAtEnd(20);
list.AddAtEnd(30);
list.AddAtEnd(40);
list.AddAtBeginning(10);
Iterator iterator = list.GetIterator();
iterator.MoveToStart();
iterator.MoveForward();
I would expect to still get an output of 10, 20, 30, 40 when I cycle
through the list but it only outputs 20, 30 40. Similarly, if I were to
call MoveForward() one more time it would only output 30, 40.
Because of the size of the files I wont post the code here but I have
provided URLs to my LinkedList classes below:
http://www.dunmanifestin.co.uk/LinkedList.cpp
http://www.dunmanifestin.co.uk/LinkedList.h
I would be really grateful if someone could have a look at my files and
try and figure out what I'm doing wrong.
Thanks,
Darrell
p.s. The operator overloader that I've put in I can only seem to get to
work if I put everything in the header file. Is it possible to split it
up between the header and the source like all the other member
functions?