// erase element from vector by its index
vector<string> strs {"first", "second", "third", "last"};
string element = "third"; // the element which will be erased
for(int i=0;i<strs.size();i++)
{
if(strs[i] == element)
strs.erase(strs.begin()+i);
}