This question already has an answer here:
I can remove a vector if am using standard for Loop.
What would be the procedure if am using a for each loop.
std::vector< std::shared_ptr<Sum_Function> > Functions; // Member of Container Class.
void Container::RemoveFunction(std::string stdstrFunctionName)
{
for (auto &func : this->Functions)
{
if (func->getFunctionName() == stdstrFunctionName)
{
// Remove from vector
// vec.erase(vec.begin() + i); i could have done in for loop
}
}
}
Aucun commentaire:
Enregistrer un commentaire