This class uses global pool and can be used with many STL containers. Any allocation/deallocation methods use mem_get_sized() and mem_put_sized() functions.
For example:
std::vector<double, omni::pool::Allocator<double> > a; std::list<int, omni::pool::Allocator<int> > b;
| typedef T value_type |
Value type.
| typedef const T& const_reference |
Constant reference type.
| typedef T& reference |
Reference type.
| typedef const T* const_pointer |
Constant pointer type.
| typedef T* pointer |
Pointer type.
| typedef ptrdiff_t difference_type |
Difference type.
| typedef size_t size_type |
Size type.
| Allocator | ( | ) | [inline] |
Default constructor.
| const_pointer address | ( | const_reference | x | ) | const [inline] |
Get address by constant reference.
| [in] | x | The constant reference. |
Get address by reference.
| [in] | x | The reference. |
The memory allocation.
This method allocates memory block for n objects.
| [in] | n | The number of adjacent objects. |
The memory allocation.
This method allocates memory block for n objects. Second argument (allocation hint) is not used.
| [in] | n | The number of adjacent objects. |
| char* _Charalloc | ( | size_type | n | ) | [inline] |
The memory allocation.
This method allocates memory block of n bytes. It is used by STL containers in Visual C++ 6.0!
| [in] | n | The memory block size in bytes. |
| void deallocate | ( | void * | p, | |
| size_type | ||||
| ) | [inline] |
The memory deallocation.
This method deallocates memory block p. the second argument (memory block size) is not used.
| [in] | p | The memory block. |
| void construct | ( | pointer | p, | |
| const_reference | x | |||
| ) | [inline] |
Object construction.
This method constructs the object at address p using placement new operator.
| [in] | p | The address of object. |
| [in] | x | Construction prototype. |
| void destroy | ( | pointer | p | ) | [inline] |
Object destruction.
This method destroys object p.
| [in] | p | The address of object. |
| size_type max_size | ( | ) | const [inline] |
Maximum number of objects.
This method returns the maximum number of objects, which can be allocated using this allocator.
1.5.2