Node:The default allocator, Previous:Allocator requirements, Up:Allocators



The default allocator

allocator Allocator
allocator Allocator

template 
class allocator {
public:
    typedef T* pointer;
    typedef const T* const_pointer;
    typedef T& reference;
    typedef const T& const_reference;
    typedef T value_type;
    typedef size_t size_type;
    typedef ptrdiff_t difference_type;
    allocator();
    ~allocator();
    pointer address(reference x);
    const_pointer const_address(const_reference x);
    pointer allocate(size_type n);
    void deallocate(pointer p);
    size_type init_page_size();
    size_type max_size();
};

class allocator {
public:
    typedef void* pointer;
    allocator();
    ~allocator();
};

In addition to allocator the library vendors are expected to provide allocators for all supported memory models.