Allocators implement resource unit allocation and are responsible for initiating resource revocation when no more resource units are available.
<Off allocator. >= (U->)
// A resource allocator.
//
class off_Allocator {
protected:
<Other protected members of off_Allocator. >
public:
<Other public methods of off_Allocator. >
};
Definesoff_Allocator(links are to index).
We could have defined a resource allocation interface at this point,
but doing so would mean that explicit type casts (prone to errors)
would be necessary on each resource allocation. Instead, what we do is
to build a hierarchy using the Allocator class as a base. That
hierarchy uses a void pointer based resource allocation interface
which is wrapped by type-safe interfaces. In that way we avoid code
duplication (due to template instantiations), dynamic binding and type
information loss.