Why do smart pointers null out the wrapped pointer before destroying it?--Raymond Chen

Save to:
Instapaper Pocket Readability

Ever thought about it?

Why do smart pointers null out the wrapped pointer before destroying it?

by Raymond Chen

From the article:

When you null out a smart pointer type, the smart pointer type nulls out the old pointer before releasing it, rather than releasing the member and then setting it to null. Why does the old value get detached from the smart pointer before releasing it? Why not release it, and then set it to null?

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.