BloombergLP::bdlma::BufferImpUtil::allocateFromBufferRaw

Allocate a memory block from a buffer using the specified alignment strategy, without checking capacity.

Synopsis

Declared in <bdlma_bufferimputil.h>

static
void*
allocateFromBufferRaw(
    bsls::Types::IntPtr* cursor,
    char* buffer,
    bsls::Types::size_type size,
    bsls::Alignment::Strategy strategy);

Description

Allocate a memory block of the specified size (in bytes) from the specified buffer at the specified cursor position, using the specified alignment strategy. Return the address of the allocated memory block. The cursor is set to the first byte position immediately after the allocated memory. The behavior is undefined unless 0 < size, buffer contains sufficient available memory, and cursor refers to a valid position in buffer.

Return Value

address of the allocated memory block

Parameters

NameDescription
cursorbyte offset into buffer at which to allocate
buffermemory buffer from which to allocate
sizesize in bytes of the memory block to allocate
strategyalignment strategy used to align the allocated block