O'Reilly logo

Sams Teach Yourself C++ in One Hour a Day, Sixth Edition by Bradley Jones, Siddhartha Rao, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 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 a smarter option.

In this lesson, you will learn

  • What smart pointers are and why you need them

  • How smart pointers are implemented

  • Different smart pointer types

  • The C++ standard library–supplied smart pointer class auto_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 supplies additional value by ensuring proper and timely destruction of dynamically allocated data and/or implementation of a well-defined object life-cycle management strategy. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required