Name: Anonymous 2009-10-16 0:33
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:
for(int i = 0; i < myVector.capacity(); i++)
{
if(myVector.getName().compare("Brian")
{
myVector.erase(myVector.begin()+1);
}
}
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> myVector holds my own object type (<File>).
I should've just used an array >.< but it will be resized often
It's going something like this:
for(int i = 0; i < myVector.capacity(); i++)
{
if(myVector.getName().compare("Brian")
{
myVector.erase(myVector.begin()+1);
}
}
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> myVector holds my own object type (<File>).
I should've just used an array >.< but it will be resized often