C++: Difference between revisions
Line 175: | Line 175: | ||
There are a few ways to do this: | There are a few ways to do this: | ||
* Use smart pointers | * Use smart pointers | ||
* Copy-and-swap idiom | * Copy-and-swap idiom [https://stackoverflow.com/questions/3279543/what-is-the-copy-and-swap-idiom Reference] | ||
* Call a clear/shrink/deallocate function | * Call a clear/shrink/deallocate function | ||
Example [https://stackoverflow.com/questions/3054567/right-way-to-deallocate-an-stdvector-object Reference]: | Example [https://stackoverflow.com/questions/3054567/right-way-to-deallocate-an-stdvector-object Reference]: |