Sets or resets the user-defined memory allocation functions for the pool. This can only be called when no memory is allocated from the pool yet, otherwise results are undefined. Allocation function must not return invalid pointer on failure. It should either throw, stop the program, or use longjmp()
function to pass control to other place of program. If it returns invalid pointer, results are undefined.
User defined allocation functions must have the following forms:
void *allocate(std::size_t size);
void free(void *pointer);
- Parameters:
-
af | Allocation function, or 0 to restore default function |
ff | Free function, or 0 to restore default function |