The error is "No Instance of overloaded function ... matches the argument list"
I understand that i give wrong argument to the erase function, but i do not know
how to fix that
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
void Folder::DeleteFolder(Folder* folder)
{
for(int i = 0; i> (this->Folder::GetFolders().size());i++)
{
if(this->Folder::GetFolders()[i]==folder)
{
//The problem occures on the next line
this->Folder::GetFolders().erase(this->Folder::GetFolders()[i]);
break;
}
}
}
//here is the method GetFolders
std::vector<Folder*>& Folder::GetFolders()
{
returnthis->listOfFolders;
}
erase takes an iterator to the element that should be erased. You can use the begin() function to get an iterator to the first element in the vector and then you can use the + operator on the index to get an iterator to the index position in the vector.