Create a buffer allocator that allocates from the specified buffer.

Synopsis

Declared in <bslma_bufferallocator.h>

BufferAllocator(
    char* buffer,
    size_type bufSize,
    AllocCallback allocCallback = 0);

Description

Create a buffer allocator for allocating memory blocks from the specified buffer of the specified bufSize. Optionally specify a callback function allocCallback that is invoked when a call to allocate cannot be fulfilled from buffer. Note that maximum alignment is used when allocating memory.

Parameters

Name

Description

buffer

Memory buffer from which to allocate.

bufSize

Size (in bytes) of buffer.

allocCallback

Optional callback invoked when allocation fails.

Created with MrDocs