Previous fileTop of DocumentContentsIndex pageNext file
Apache C++ Standard Library Reference Guide

allocator

Library:  General utilities


Does not inherit

Local Index

Members

Summary

The default allocator object for storage management in C++ Standard Library containers

Synopsis

#include <memory>

namespace std {
  template <class T>
  class allocator;
}

Specializations

Description

Containers in the C++ Standard Library allow you to control storage management through the use of allocator objects. Each container class has an allocator template parameter specifying the type of allocator to be used. Every constructor, except the copy constructor, has an allocator parameter, allowing you to pass in a specific allocator. A container uses that allocator for all storage management.

The library has a default allocator, called allocator. This allocator uses the global new() and delete() operators. By default, all containers use this allocator. You can also design your own allocator, but if you do so it must have an appropriate interface.

Interface

Member Types

size_type
difference_type
pointer
const_pointer
reference
const_reference
value_type
template <class U> struct rebind;

Constructors

allocator()
template <class U> 
allocator(const allocator<U>&) 

Destructors

~allocator()

Member Functions

pointer
address(reference x) const;
const_pointer 
address(const_reference x) const;
pointer 
allocate(size_type n, 
         typename allocator<void>::const_pointer p = 0)
void 
deallocate(pointer p, size_type n)
size_type 
max_size() const;
void 
construct(pointer p, const T& val);
void 
destroy(pointer p)

See Also

Containers

Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 20.4.1



Previous fileTop of DocumentContentsIndex pageNext file