Standard C++ Library Reference ISO/IEC (VERSION3)

collection. Hence, a class that allocates storage using an allocator object should use these types
religiously for declaring pointer and reference objects (as do the containers in the Standard C++
library).
Thus, an allocator defines the types (among others):
pointer -- behaves like a pointer to Ty
const_pointer -- behaves like a const pointer to Ty
reference -- behaves like a reference to Ty
const_reference -- behaves like a const reference to Ty
These types specify the form that pointers and references must take for allocated elements.
(allocator::pointer is not necessarily the same as Ty * for all allocator objects, even
though it has this obvious definition for class allocator.)
allocator::address
pointer address(reference val) const;
const_pointer address(const_reference val) const;
The member functions return the address of val, in the form that pointers must take for
allocated elements.
allocator::allocate
template<class Other>
pointer allocate(size_type count, const Other *hint = 0);
The member function allocates storage for an array of count elements of type Ty, by calling
operator new(count). It returns a pointer to the allocated object. The hint argument
helps some allocators in improving locality of reference -- a valid choice is the address of an
object earlier allocated by the same allocator object, and not yet deallocated. To supply no hint,
use a null pointer argument instead.
allocator::allocator
allocator();
template<class Other>
allocator(const allocator<Other>& right);
The constructor does nothing. In general, however, an allocator object constructed from another
allocator object should compare equal to it (and hence permit intermixing of object allocation
and freeing between the two allocator objects).