The discussion of smart pointers seems never-ending, but one thing is quite clear—no smart pointer design is a panacea. Another thing that is relatively apparent is that a pointer class that automatically destroys the resource is not always desirable. In this article, I describe two hypothetical pointer classes that help prevent and catch errors but do not automatically destroy the resource. I then introduce a single umbrella pointer class, which provides an implementation that covers both cases.
展开▼