C++ set null to all pointers when deleting an object via one of them -


i have object, , have many pointers referring it. in different places can deleted, once in 1 place deleted, other places should aware of deletion. should check if object not deleted, delete. there smart pointer can job?

std::shared_ptr can this, along std::weak_ptr

i let google syntax yourself, basically, object held shared_ptr deleted when last shared_ptr goes out of scope, , weak ptrs able detect , stop working.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -