Used as a template argument for container classes (
smplbuf, smplque) to specify or allocate internal memory regions.This class is not intended to be used directly in user code, but it is internally used for declaring containers.
| Class Name | Description |
|---|---|
alloc_attach<T> | Attach an existing buffer |
alloc_local<T, int N> | Statically allocate a buffer of N bytes internally |
alloc_heap<T> | Allocate the specified size on the heap |
For alloc_attach and alloc_heap, you must call the appropriate initialization method (init_???()) depending on the allocator type.
Initialization
void attach(T* p, int n) // alloc_attach
void init_local() // alloc_local
void init_heap(int n) // alloc_heap
Initializes with buffer p and size n.
Methods
alloc_size()
uint16_t alloc_size()
Returns the size of the buffer.
_is_attach(), _is_local(), _is_heap()
These methods trigger a compile-time error using static_assert if an incompatible allocator method is used.