Skip to content

Instantly share code, notes, and snippets.

@caviles
Created June 9, 2017 04:58
Show Gist options
  • Save caviles/90c5bd8aa9f7529022cd685f68edfb84 to your computer and use it in GitHub Desktop.
Save caviles/90c5bd8aa9f7529022cd685f68edfb84 to your computer and use it in GitHub Desktop.
C++ smart pointers
smart pointers
shared pointer - bumps ref
weak pointer - doesn't bump ref
uniqiue pointer - can't be copied
auto pointer - this is a weak attempt at smart pointers - don't use this it has many problems in containers
pResource=std::make_shared<Resource>("Resource for " + GetName()); // init a shard ptr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment