Class CGAL::allocator<T>

Definition

An instance A of the data type allocator<T> is a memory allocator according to the C++standard.

Types

Local types are size_type, difference_type, value_type, pointer, reference, const_pointer, and const_reference.

template <class T1>
allocator<T>:: rebind
allows the construction of a derived allocator:
allocator<T>::template rebind<T1>::other
is the type allocator<T1>.

Creation

allocator<T> A;
introduces a variable A of type allocator<T>.

Operations

pointer A.allocate ( size_type n, const_pointer = 0)
returns a pointer to a newly allocated memory range of size n * sizeof(T).

void A.deallocate ( pointer p, size_type n)
deallocates a memory range of n * sizeof(T) starting at p.
Precondition: the memory range was obtained via allocate(n).

pointer A.address ( reference r) returns &r.

const_pointer A.address ( const_reference r) returns &r.

void A.construct ( pointer p, const_reference r)
copies the object referenced by r to *p. (Technically this is achieved by an inplace new new( (void*)p ) T(r)).

void A.destroy ( pointer p) destroys the object referenced via p by calling p->~T().

size_type A.max_size () the largest value n for which the call allocate(n,0) might succeed.