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