Hi,
I have a program, which uses a vector to store some pointers.
The program works fine.
I'm trying to convert it to use a doubly linked list now though.
At the top of the program I changed:
vector<Diary *>vectorname;
to
#include <list>
list<Diary *>vectorname;
list<Diary*>::iterator i = vectorname.begin();
Later on in the program I access an element of the (former) vector using:
if(vectorname[a]->getName() == leadToDelete)
And use:
if(advance(i,a)->getName() == leadToDelete)
{
//do something
}
instead.
BUt when I try it fails to compile, saying:
error C2227: left of '->getName' must point to class/struct/union/generic type
I was hoping this would be a simple way to do the conversion, but I have made a mistake in the code above it seems.
Could anyone show me how I do this?
Many thanks for any help!