BloombergLP::bslma::BufferAllocator::BufferAllocator

Create a buffer allocator that allocates from the specified buffer using the specified alignment strategy.

Synopsis

Declared in <bslma_bufferallocator.h>

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

Description

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

Parameters

NameDescription
bufferMemory buffer from which to allocate.
bufSizeSize (in bytes) of buffer.
strategyAlignment strategy used for allocations.
allocCallbackOptional callback invoked when allocation fails.