Ok this is driving me nuts. I'm working in C++ and trying to delete an element from a vector
It's going something like this (dirPath is a stack of directories, and dirPtrs the list of what a directory points to)
for(int i = 0; i < dirPath.top().dirPtrs.capacity(); i++)
{
string temp = StringToUpper((dirPath.top()).dirPtrs.at(i).getFileName());
if(command.compare(temp) == 0)
{
dirPath.top().dirPtrs::iterator it= dirPath.top().dirPtrs.erase(dirPath.top().dirPtrs.begin()+1);
foundDir = true;
}
}
From what I've seen online I have to use an iterator but the only examples of that I can find are when using a vector that holds the type<int> dirPtrs holds my own object type (<File>).
I should've just used an array >.< but it will be resized often so it lead me to using a vector
The issue being every time I try to do what I see in online examples dirPtrs::iterator it does not work. It gives me iterator is not a member of "File" being the header file for my object type I assume, and that dirPtrs is not a class or namespace name.