Time complexity of vector's element deletion.

if all you want do is to remove item with value = 5, can’t this code suffice?
.
.

#include <algorithm>

std::remove_if ( vec.begin(), vec.end() , [](int i)
    {
       return ( i == 5 );
    });

I do have a doubt though! does this sort of STL’s use impact runtime performance?

That logic was to be used to solve a practice problem on hackerearth. I went on using vectors but got lots of TLE and hence got confused.