Item 43. auto_ptr Is Unusual
Whenever one discusses RAII, it’s necessary to discuss auto_ptr. This is always a task. It’s not that we’re ashamed of auto_ptr, mind you, but it’s kind of like explaining your brother to strangers; he’s a superlative person, but you have to be in the right frame of mind to appreciate that. And there’s no denying that both your brother and auto_ptr have a different worldview from the typical person or object, respectively.
As we discussed in RAII [40, 139], the use of resource handles is a pervasively employed technique in C++ programming, so the standard library supplies a resource handle template that serves many resource handle needs: auto_ptr. The auto_ptr class template is used to generate smart pointers (see ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access