You can avoid the extra variable.
v.push_back(v[itemIndex]);
v.erase(v.begin() + itemIndex);
If you delete frequently from the middle of the vector and can rewrite your code so that it doesn't require random access, you may be able to improve efficiency by using a linked list (std::list
) instead.