🎉 Smithery is now a part of Arcade.dev! Read more in our announcement here
Mastering C++ Smart Pointers: unique_ptr, shared_ptr, weak_ptr. Triggers: memory management, cycles, enable_shared_from_this, make_unique, make_shared, custom deleters.
How many owners does this resource to have?
std::unique_ptr
std::shared_ptr
std::weak_ptr
shared_ptr
weak_ptr
unique_ptr
Can I use unique_ptr?
std::move
Is this a Cycle?
Do I need a custom deleter?
FILE*
SDL_Surface*
unique_ptr<FILE, DeclType(&fclose)>
Trace Up:
Trace Down:
std::vector<std::unique_ptr<Base>>
make_unique
make_shared
enable_shared_from_this
shared_from_this()