Using rogue wave's alternative interface – HP Integrity NonStop H-Series User Manual
Page 201
constructor for T. The effect is:
new((void*)p) T(u)
template
void
destroy(types
Call the destructor on the value pointed to by p. The effect is:
((T*)p)->~T()
template
my_allocator::types
operator new(my_allocator::types
Allocate space for a single object of type T using my_allocator::allocate. The effect is:
new((void*)x.template allocate
template
my_allocator::types
operator new[](my_allocator::types
my_allocator&);
Allocate space for an array of objects of type T using my_allocator::allocate. The effect is:
new((void*)x.template allocate
bool
operator==(const my_allocator& a, const my_allocator& b);
Return true if allocators b and a can be safely interchanged. "Safely interchanged" means
that b could be used to deallocate storage obtained through a and vice versa.
Using Rogue Wave's Alternative Interface
Rogue Wave provides an alternative allocator interface for those compilers that do not support
both class templates and member function templates.
In this interface, the class allocator_interface provides all types and typed functions. Memory is
allocated as raw bytes using the class provide by the Allocator template parameter. Functions
within allocator_interface cast appropriately before returning pointer values. Because multiple
allocator_interface objects can attach to a single allocator, one allocator can allocate all storage
for a container, regardless of how many types are involved. The one real restriction is that
pointers and references are hard-coded as type T* and T&. (Note that in the standard interface
they are implementation_defined.). If your compiler supports partial specialization instead of
member templates you can use it to get around even this restriction by specializing
allocator_interface on just the allocator type.
To implement an allocator based on the alternative interface, supply the class labeled
my_allocator below.
//