Lesson 26. Understanding Smart Pointers
C++ programmers do not necessarily need to use plain pointer types when managing memory on the heap (or the free store); they can make use of smart pointers.
In this lesson, you learn
• What smart pointers are and why you need them
• How smart pointers are implemented
• Different smart pointer types
• Why you should not use the deprecated std::auto_ptr
• The C++11 Standard Library smart pointer std::unique_ptr
• Popular smart pointer libraries
What Are Smart Pointers?
Very simply said, a smart pointer in C++ is a class with overloaded operators, which behaves like a conventional pointer. Yet, it supplies additional value by ensuring proper and timely destruction of dynamically allocated data and facilitates ...
Get Sams Teach Yourself C++ in One Hour a Day, Seventh Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.