Smart pointers are used extensively in Aspell to simplify memory management tasks and to avoid memory leaks.
CopyPtr class makes a deep copy of an object whenever it is
CopyPtr class is defined in copy_ptr.hpp.
This header should be included wherever
CopyPtr is used. The
complete definition of the object
CopyPtr is pointing to does
not need to be defined at this point. The implementation is defined
in copy_ptr-t.hpp. The implementation header file should be
included at a point in your code where the class
pointing to is completely defined.
ClonePtr is like copy pointer except the
is used instead of the copy constructor to make copies of an object.
If is defined in clone_ptr.hpp and implemented in
StackPtr is designed to be used whenever the only pointer to
a new object allocated with new is on the stack. It is
similar to the standard C++
auto_ptr but the semantics are a
bit different. It is defined in stack_ptr.hpp — unlike
ClonePtr it is defined and implemented in
this header file.
A generalized version of
ClonePtr which the
two are based on. It is defined in generic_copy_ptr.hpp and
implemented in generic_copy_ptr-t.hpp.