From cplusplus.com
iterator erase ( iterator position );
iterator erase ( iterator first, iterator last );
This effectively reduces the vector
size by the number of elements
removed, calling each element's
destructor before.
Because vectors keep an array format,
erasing on positions other than the
vector end also moves all the elements
after the segment erased to their new
positions, which may not be a method
as efficient as erasing in other kinds
of sequence containers (deque, list).
This invalidates all iterator and
references to elements after position
or first.
In this case, you still have your object f, because you declared it before copying it (via pushback) into the vector.
When you erase from the vector the destructor is called on the copied object and the vector's iterator are broken.