C++ delete vector, objects, free memory states that in order to release allocated heap memory after clearing an std::vector, one can do:
vector<int>().swap(myVector);
That makes sense, but I wonder whether the following wouldn't achieve the same. Can someone tell me whether there's a difference?
myVector = vector<int>();