Another option is to use the splicing method.
Array :: splicing documentation
For an array, the following call empties it:
array.splice(0);
The second parameter is applied to the vector, so the call becomes:
vector.splice(0, vector.length);
Lopse source share