Return a newly allocated block of memory of (at least) the specified positive size (in bytes). If size is 0, a null pointer is returned with no other effect. If this allocator cannot return the requested number of bytes, then it will return the result of invoking an optional callback function (supplied at construction); if no callback function was specified, throw a std::bad_alloc exception in an exception‐enabled build, or else abort the program in a non‐exception build. The behavior is undefined unless 0 <= size. Note that the alignment of the address returned depends on the alignment strategy (MAXIMUM_ALIGNMENT or NATURAL_ALIGNMENT) specified at construction of this buffer allocator. Also note that it is up to the callback function whether to return zero or throw an exception if this buffer allocator is unable to satisfy the request.

Synopsis

Declared in <bslma_bufferallocator.h>

virtual
void*
allocate(size_type size) override;

Created with MrDocs