vector[i].clear in c++ code example Example: C++ Vector clear syntax vector<T>().swap(x); // clear x reallocating