If you don't want to modify the vector (erase, sort) then you can use the Newton library, In the algorithm sublibrary there is a function call, copy_single
template <class INPUT_ITERATOR, typename T>
void copy_single( INPUT_ITERATOR first, INPUT_ITERATOR last, std::vector<T> &v )
so You can:
std::vector<TYPE> copy; // empty vector
newton::copy_single(first, last, copy);
where copy is the vector in where you want to push_back the copy of the unique elements. but remember you push_back the elements, and you don't create a new vector
anyway, this is faster because you don't erase() the elements (which takes a lot of time, except when you pop_back(), because of reassignment)
I make some experiments and it's faster.
Also, you can use:
std::vector<TYPE> copy; // empty vector
newton::copy_single(first, last, copy);
original = copy;
sometimes is still faster.