#include <reallocator.h>
Public Member Functions | |
pointer | allocate (size_type size, std::allocator< void >::const_pointer hint=0L) |
void | deallocate (pointer ptr, size_type) |
pointer | reallocate (pointer ptr, size_type, size_type new_size) |
void | move (pointer dst, pointer src, size_type size) |
This allocator uses malloc(), realloc() and free() directly for elements space allocation/reallocation/deallocation.
This allocator uses memmove() directly when reallocating element space to copy elements from the orignal location to the new location without the need to call constructors and destructors (not even inplace destructors).
Definition at line 232 of file reallocator.h.
pointer mbo::mem_reallocator< __ValueType >::allocate | ( | size_type | size, | |
std::allocator< void >::const_pointer | hint = 0L | |||
) | [inline] |
Use malloc() to allocate size number of uninitialized elements
size | number of elements to allocate | |
hint | ignored here |
Definition at line 242 of file reallocator.h.
References mbo_malloc.
00243 { 00244 return static_cast<pointer>(mbo_malloc(size * sizeof(value_type))); 00245 }
void mbo::mem_reallocator< __ValueType >::deallocate | ( | pointer | ptr, | |
size_type | ||||
) | [inline] |
Frees an element space
ptr | original pointer | |
size | number of elements (ignored) |
Definition at line 254 of file reallocator.h.
pointer mbo::mem_reallocator< __ValueType >::reallocate | ( | pointer | ptr, | |
size_type | , | |||
size_type | new_size | |||
) | [inline] |
Reallocate element space using realloc()
ptr | original pointer | |
old_size | original number of elements (ignored) | |
new_size | new number of elements |
Reimplemented from mbo::reallocator< __ValueType >.
Definition at line 269 of file reallocator.h.
References mbo_realloc.
00270 { 00271 return static_cast<pointer>(mbo_realloc(ptr, new_size * sizeof(value_type))); 00272 }
void mbo::mem_reallocator< __ValueType >::move | ( | pointer | dst, | |
pointer | src, | |||
size_type | size | |||
) | [inline] |
Moves size elements from src to dst using memmove()
dst | destination pointer | |
src | source pointer | |
size | number of elements to move |
Reimplemented from mbo::reallocator< __ValueType >.
Definition at line 282 of file reallocator.h.
00283 { 00284 memmove(dst, src, size * sizeof(value_type)); 00285 }
Hosted on code.google.com | © Marcus Börger | Generated on Fri Jan 18 21:21:13 2008 for MBO-lib by ![]() |