![]() | InDesign SDK 20.5 |
#include <K2Allocator.h>
Classes | |
| struct | rebind |
Public Member Functions | |
| K2Allocator () | |
| template<class U > | |
| K2Allocator (const K2Allocator< U > &) | |
| pointer | address (reference x) const |
| const_pointer | address (const_reference x) const |
| pointer | allocate (size_type n, const void *hint=nil) |
| void | deallocate (pointer p, size_type) |
| size_type | max_size () const |
| void | construct (pointer p, const T &val) |
| void | destroy (pointer p) |
Allocators represent a special memory model and are an abstraction used to translate the need to use memory into a raw call for memory. K2Allocator is the default allocator used by the new K2 collections (like K2Vector). This class would be deprecated soon along with the other K2 containers.
| inline |
Default constructor. Creates an empty allocator.
| inline |
Returns address of values.
| x | [IN] - a value. |
| inline |
Allocates but doesn't initialize n elements of type T.
| n | [IN] - number of element of type T to allocate space for. |
| hint | [IN] - not used. |
| inline |
Initializes the storage of one element to which p refers with value.
| p | [IN] - pointer to the storage. |
| val | [IN] - value for initialization. |
| inline |
Frees the storage to which p refers. The storage p has to be allocated by allocate() of the same or an equal allocator. The elements should have been destroyed already.
| p | [IN] - pointer to the storage to be freed. |
| inline |
Destroys the object to which p refers without deallocating the storage. Simply calls the destructor for the object.
| p | [IN] - pointer to the object. |
| inline |
Returns the maximum number of elements that can be allocated.