#include <stlsoft/memory/allocator_base.hpp>
T | The allocator value_type | |
A | The adapted/derived allocator type |
void *do_allocate(size_type n, void const* hint);
- allocates n
bytes, optionally taking into account the locality hint
. Return NULL
or throw std::bad_alloc
if the allocation fails.void do_deallocate(void *pv, size_type n);
- deallocates the memory block pointed to by pv
, which is n
bytes in size.void do_deallocate(void *pv);
- deallocates the memory block pointed to by pv
.
Types | |
typedef T | value_type |
The value type. | |
typedef allocator_base< T, A > | class_type |
The type of the current parameterisation. | |
typedef value_type * | pointer |
The pointer type. | |
typedef value_type const * | const_pointer |
The non-mutating (const) pointer type. | |
typedef value_type & | reference |
The reference type. | |
typedef value_type const & | const_reference |
The non-mutating (const) reference type. | |
typedef ss_ptrdiff_t | difference_type |
The difference type. | |
typedef size_t | size_type |
The size type. | |
Public Member Functions | |
Attributes | |
size_type | max_size () const throw () |
Returns the maximum number of allocatable entities. | |
Conversion functions | |
pointer | address (reference x) const throw () |
Returns the address corresponding to the given reference. | |
const_pointer | address (const_reference x) const throw () |
Returns the address corresponding to the given non-mutable (const) reference. | |
Allocation | |
pointer | allocate (size_type n, void const *hint=NULL) |
Allocates a block of memory sufficient to store n elements of type value_type . | |
char * | _Charalloc (size_type n) |
A method required by the Dinkumware libraries shipped with older versions of Visual C++. | |
void | deallocate (deallocate_pointer p, size_type n) |
Deallocates a pointer. | |
void | deallocate (deallocate_pointer p) |
Deallocates a pointer. | |
Object initialisation | |
void | construct (pointer p, value_type const &x) |
In-place constructs an instance of the value_type , with the given value. | |
void | construct (pointer p) |
In-place constructs an instance of the value_type . | |
void | destroy (pointer p) throw () |
In-place destroys an instance. |
typedef T value_type |
The value type.
Reimplemented in static_array_1d, static_array_2d, static_array_3d, static_array_4d, malloc_allocator, new_allocator, and null_allocator.
typedef allocator_base<T, A> class_type |
The type of the current parameterisation.
Reimplemented in static_array_1d, static_array_2d, static_array_3d, static_array_4d, malloc_allocator, new_allocator, and null_allocator.
typedef value_type* pointer |
The pointer type.
Reimplemented in static_array_1d, static_array_2d, static_array_3d, static_array_4d, malloc_allocator, new_allocator, and null_allocator.
typedef value_type const* const_pointer |
The non-mutating (const) pointer type.
Reimplemented in static_array_1d, static_array_2d, static_array_3d, static_array_4d, malloc_allocator, new_allocator, and null_allocator.
typedef value_type& reference |
The reference type.
Reimplemented in static_array_1d, static_array_2d, static_array_3d, static_array_4d, malloc_allocator, new_allocator, and null_allocator.
typedef value_type const& const_reference |
The non-mutating (const) reference type.
Reimplemented in static_array_1d, static_array_2d, static_array_3d, static_array_4d, malloc_allocator, new_allocator, and null_allocator.
typedef ss_ptrdiff_t difference_type |
The difference type.
Reimplemented in static_array_1d, static_array_2d, static_array_3d, static_array_4d, malloc_allocator, new_allocator, and null_allocator.
The size type.
Reimplemented in static_array_1d, static_array_2d, static_array_3d, static_array_4d, malloc_allocator, new_allocator, and null_allocator.
size_type max_size | ( | ) | const throw () [inline] |
Returns the maximum number of allocatable entities.
Returns the address corresponding to the given reference.
x | A reference to a value_type instance whose address will be calculated |
const_pointer address | ( | const_reference | x | ) | const throw () [inline] |
Returns the address corresponding to the given non-mutable (const) reference.
x | A non-mutable (const) reference to a value_type instance whose address will be calculated |
Allocates a block of memory sufficient to store n
elements of type value_type
.
n | The number of elements to allocate | |
hint | A hint to enhance localisation |
Referenced by allocator_base< T, stlsoft::new_allocator< T > >::_Charalloc().
A method required by the Dinkumware libraries shipped with older versions of Visual C++.
The method is functionally identical to static_cast<char*>(allocate(n, NULL))
void deallocate | ( | deallocate_pointer | p, | |
size_type | n | |||
) | [inline] |
Deallocates a pointer.
p | The memory block to deallocate | |
n | The number of blocks to deallocate |
void deallocate | ( | deallocate_pointer | p | ) | [inline] |
Deallocates a pointer.
p | The memory block to deallocate |
void construct | ( | pointer | p, | |
value_type const & | x | |||
) | [inline] |
In-place constructs an instance of the value_type
, with the given value.
p | The location in which to construct the instance | |
x | The value with which to copy construct the instance |
void construct | ( | pointer | p | ) | [inline] |
In-place constructs an instance of the value_type
.
p | The location in which to construct the instance |
void destroy | ( | pointer | p | ) | throw () [inline] |
In-place destroys an instance.
p | The instance whose destructor is to be called |