Threads Module User's Guide : PART III Foundation Packages : Chapter 7 The Smart Pointer Package : Using the Smart Pointer Classes
Using the Smart Pointer Classes
In addition to the handle-body and singleton patterns, the Smart Pointer package contains three lower-level smart pointer classes that you can use to create your own higher-level abstractions. These template classes all provide exception-safe dynamic memory allocation. In addition:
RWTOnlyPointer<Body> implements strict ownership semantics
RWTCountedPointer<Body> automatically garbage-collects reference-counted objects.
RWTCountingPointer<Body,Counter> uses reference counting to garbage-collect objects that do not directly support reference counting.
Each of these classes is an abstraction that simplifies the use of pointers referring to objects on the heap. The pointed-to object is called the pointer’s body. The pointer class’s Body template parameter specifies the type of object to which this pointer can refer.