C++ Shared Pointer
Let’s write a C++ shared pointer. Shared pointers are smart pointers that ensure the freeing of memory when the last reference to it is deleted. Fundamentally, smart pointers take advantage of a class’ destructor. When an object goes out of scope, its destructor is called. When a shared pointer goes out of scope, logic in […]