vector decoy; void clear_decoy() { decoy.clear(); vector (decoy).swap(decoy); }
In the above method
clear removes all entries from the vector, but may not necessarily deallocate the space. This swap idiom restores the vector to having no space allocated.
clear