删除每个循环使用的向量元素

时间:2019-09-04 04:58:48

标签: c++ c++11

如果使用标准的Loop,我可以删除一个向量。

如果每个循环都使用a,将执行什么步骤。

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
        }
    }
}

0 个答案:

没有答案
相关问题