Implement a magic-pointer that manages objects based on a refcount held in
the pointed-to object.
The following classes are implemented:
(*) refcount
This class holds the refcount and is intended to be subclassed by any
object that will be pointed to.
(*) ref<to_class>
This is a template pointer class that pins a reference on the object
it points to, which must be of or derived from type to_class.
to_class must be derived from class refcount.
(*) pointer<to_class>
This is like ref<to_class> but doesn't pin a reference. It has no
copy constructor, thereby allowing it to be passed in a register as an
argument or a return value.
(*) opaque_ref
This class points to any object derived from class refcount and will
pin a reference on the object.
(*) opaque_pointer
This is like class opaque_ref, but doesn't pin a reference. It has no
copy constructor, thereby allowing it to be passed in a register as an
argument or a return value.
Objects can be assigned between any pair of classes. Assigning from an
opaque ref/pointer to a template-typed ref/pointer will dynamic_cast the
value (if it's not NULL).
Signed-off-by: David Howells <dhowells@redhat.com>