Shared Pointers using std::shared_ptr

An introduction to shared memory ownership using std::shared_ptr

Ryan McCombe
Updated
Hello! I'm here to help you with any questions about this lesson. Feel free to ask me anything - whether it's about specific concepts, examples, or how to apply what you've learned!

Questions & Answers

Answers are generated by AI models and may not have been reviewed. Be mindful when running any code on your device.

Deleting a Shared Pointer Twice
What happens if I manually delete a shared pointer twice using the delete keyword?
Creating a shared_ptr to this
Is it okay to create a shared_ptr from the this pointer?
Polymorphism with Shared Pointers
How do shared pointers handle polymorphism? Can I store derived class objects in a shared_ptr of base class type?
Shared Pointers in Multithreaded Environments
Are shared pointers thread-safe? Can they be used in multithreaded applications?
Shared Pointer Cyclic References
What happens if two shared pointers reference each other? Will this cause a memory leak?
When to Use Shared Pointers
In what situations should I use shared pointers instead of unique pointers or raw pointers?