Removing by indices several elements from a vector
That's a worthwhile problem to solve, and a good solution.

Trivial fix: std::size_t is misspelt in a couple of places.

One easy change I'd make is that rm can be const std::vector&lt;INT&gt;&amp;, since we won't be modifying it.  That's helpful, as it allows the reference to bind to an rvalue if we want (test by passing std::move(toRemove)).



It might be worthwhile passing rm as an iterator pair; we can still have an overload that accepts std::vector or other container:

#include &lt;algorithm&gt;
#include &lt;cassert&gt;
#include &lt;vector&gt;

template &lt;typename T, typename Iter&gt;
void removeIndicesFromVector(std::vector&lt;T&gt;&amp; v, Iter begin, Iter end)
    // requires std::is_convertible_v&lt;std::iterator_traits&lt;Iter&gt;::value_type, std::size_t&gt;
{
    assert(std::is_sorted(begin, end));
    auto rm_iter = begin;
    std::size_t current_index = 0;

    const auto pred = [&amp;](const T&amp;){
        // any more to remove?
        if (rm_iter == end) { return false; }
        // is this one specified?
        if (*rm_iter == current_index++) { return ++rm_iter, true; }
        return false;
    };

    v.erase(std::remove_if(v.begin(), v.end(), pred), v.end());
}

template &lt;typename T, typename S&gt;
    // requires std::is_convertible_v&lt;S::value_type, std::size_t&gt;
void removeIndicesFromVector(std::vector&lt;T&gt;&amp; v, const S&amp; rm)
{
    using std::begin;
    using std::end;
    assert(std::is_sorted(begin(rm), end(rm)));
    return removeIndicesFromVector(v, begin(rm), end(rm));
}


I've changed the algorithm here to simply count the elements seen, which must be valid because std::remove_if() accepts input iterators and is specified to invoke the predicate exactly std::distance(first, last) times.

The requires lines are commented out, as I didn't manage to get them working as I'd like - I'd appreciate a comment or edit to fix that.



If we feel generous, we might be willing to accept non-sorted input (with a speed penalty, of course):

#include &lt;algorithm&gt;
#include &lt;vector&gt;

template &lt;typename T, typename Iter&gt;
void removeIndicesFromVector(std::vector&lt;T&gt;&amp; v, Iter begin, Iter end)
    // requires std::is_convertible_v&lt;std::iterator_traits&lt;Iter&gt;::value_type, std::size_t&gt;
{
    std::size_t current_index = 0;

    if (std::is_sorted(begin, end)) {

        // sorted version - advance through begin..end
        auto rm_iter = begin;
        const auto pred = [&amp;](const T&amp;) {
            // any more to remove?
            if (rm_iter != end &amp;&amp; *rm_iter == current_index++) {
                return ++rm_iter, true;
            }
            return false;
        };
        v.erase(std::remove_if(v.begin(), v.end(), pred), v.end());

    } else {

        // unsorted version - search for each index in begin..end
        const auto pred = [&amp;](const T&amp;) {
            return std::find(begin, end, current_index++) != end;
        };
        v.erase(std::remove_if(v.begin(), v.end(), pred), v.end());
    }
}

template &lt;typename T, typename S&gt;
    // requires std::is_convertible_v&lt;S::value_type, std::size_t&gt;
void removeIndicesFromVector(std::vector&lt;T&gt;&amp; v, const S&amp; rm)
{
    using std::begin;
    using std::end;
    return removeIndicesFromVector(v, begin(rm), end(rm));
}




Test of unordered remove:

#include &lt;array&gt;
#include &lt;iostream&gt;
#include &lt;string&gt;

template &lt;typename T&gt;
void print(const std::vector&lt;T&gt;&amp; v)
{
    for (auto const&amp; e: v) {
        std::cout &lt;&lt; e &lt;&lt; " ";
    }
    std::cout &lt;&lt; std::endl;
}

int main()
{
    std::vector v{"Alice", "Smith", "is", "very", "clever",
                  "and", "is", "very", "nice"};
    print(v);
    removeIndicesFromVector(v, std::array{6u,1u});
    print(v);

    return 0;
}