Since I don't think anyone else has mentioned this, but if your vector was
std::vector vector;
you should free the memory allocated to each element before the function finishes (unless you've passed ownership to somewhere else - such as a global variable etc)
for (auto i : vector) {
delete i;
}