Shared_ptr
A `shared_ptr` is a smart pointer in C++ that manages the lifetime of an object through reference counting. When multiple `shared_ptr` instances point to the same object, they keep track of how many pointers are referencing that object. When the last `shared_ptr` pointing to the object is destroyed or reset, the object is automatically deleted, preventing memory leaks.
Using `shared_ptr` simplifies memory management in C++ by ensuring that resources are released when they are no longer needed. This is particularly useful in complex applications where ownership of objects can be shared among different parts of the program, enhancing safety and reducing the risk of dangling pointers.