swap cpp vector code example
Example 1: C++ Vector swap syntax
vector<T>().swap(x); // clear x reallocating
Example 2: swap vector c++
vector1.swap<vector2>;
//time complexity: O(1)
vector<T>().swap(x); // clear x reallocating
vector1.swap<vector2>;
//time complexity: O(1)