If what you are trying to do is to search for an item in a std::vector
and erase it, it doesn't take a complex function to do so:
#include <algorithm>
//...
intList.erase(std::remove(intList.begin(), intList.end(), removeItem), intList.end());
That one line does everything your entire remove
function is attempting to do.
http://www.cplusplus.com/reference/algorithm/remove/ http://www.cplusplus.com/reference/vector/vector/erase/
In general, learn to use the STL algorithms. Moving, erasing, and ordering items in a container are operations that are routinely done in programs, therefore algorithms exist that perform these tasks.