Created
June 9, 2017 04:58
-
-
Save caviles/90c5bd8aa9f7529022cd685f68edfb84 to your computer and use it in GitHub Desktop.
C++ smart pointers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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