Skip to content
Commit 42e88bd6 authored by Mehdi Amini's avatar Mehdi Amini
Browse files

Replace sequences of v.push_back(v[i]); v.erase(&v[i]); with std::rotate (NFC)

The code has a few sequence that looked like:

    Ops.push_back(Ops[0]);
    Ops.erase(Ops.begin());

And are equivalent to:

    std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end());

The latter has the advantage of never reallocating the vector, which
would be a bug in the original code as push_back would read from the
memory it deallocated.
parent 703ef17e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment