Threads Module User's Guide : PART III Foundation Packages : Chapter 7 The Smart Pointer Package
Chapter 7 The Smart Pointer Package
Introducing the Smart Pointer Package
Smart pointers are objects that encapsulate built-in, or raw, pointers. They are useful as building blocks for implementing many idioms, including the handle-body and singleton patterns provided by this package. Smart pointers by themselves are useful for both exception-safe programming and automated garbage collection. Threads Module has always used some smart pointers internally, but in this release they have been uncovered and extended for your use.
The Threads Module Smart Pointer package provides the following features:
A handle-body implementation for creating your own handle-body hierarchies, allowing you to separate your abstractions from their implementations
A generic singleton template for adapting an existing class to behave as a singleton, enabling global access to a unique instance of the class
A simple pointer wrapper for local protection of heap allocations from memory leaks in the face of exceptions
Two varieties of thread-safe reference-counted pointers for adding exception safety and automated garbage collection to pointers that are shared among multiple objects
Interpackage Dependencies
The Smart Pointer package depends on the Thread-compatible Exception, Execution Tracing, and Synchronization packages of the Threads Module.
Including the Smart Pointer Header Files
The rw\pointer directory contains a header file for each class, named classname.h. You can also access the declarations for the entire Smart Pointer package through pointer.h, an umbrella file that includes the header files for all the classes.