[#BloombergLP-bdlma-BufferImpUtil] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlma.adoc[bdlma]::BufferImpUtil :relfileprefix: ../../ :mrdocs: This `struct` provides a namespace for a suite of pure procedures for allocating memory from a buffer. == Synopsis Declared in `<bdlma_bufferimputil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct BufferImpUtil; ---- == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlma/BufferImpUtil/allocateFromBuffer.adoc[`allocateFromBuffer`] | Allocate a memory block of the specified `size` (in bytes) from the specified `buffer` having the specified `bufferSize` (in bytes) at the specified `cursor` position, using the specified alignment `strategy`. Return the address of the allocated memory block if `buffer` contains sufficient available memory, and 0 otherwise. The `cursor` is set to the first byte position immediately after the allocated memory if there is sufficient memory, and not modified otherwise. The behavior is undefined unless `0 < size`, `0 <= *cursor`, and `*cursor <= bufferSize`. | xref:BloombergLP/bdlma/BufferImpUtil/allocateFromBufferRaw.adoc[`allocateFromBufferRaw`] | 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`. | xref:BloombergLP/bdlma/BufferImpUtil/allocateMaximallyAlignedFromBuffer.adoc[`allocateMaximallyAlignedFromBuffer`] | Allocate a maximally‐aligned memory block of the specified `size` (in bytes) from the specified `buffer` having the specified `bufferSize` (in bytes) at the specified `cursor` position. Return the address of the allocated memory block if `buffer` contains sufficient available memory, and 0 otherwise. The `cursor` is set to the first byte position immediately after the allocated memory if there is sufficient memory, and not modified otherwise. The behavior is undefined unless `0 < size`, `0 <= *cursor`, and `*cursor <= bufferSize`. | xref:BloombergLP/bdlma/BufferImpUtil/allocateMaximallyAlignedFromBufferRaw.adoc[`allocateMaximallyAlignedFromBufferRaw`] | Allocate a maximally‐aligned memory block of the specified `size` (in bytes) from the specified `buffer` at the specified `cursor` position. 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`. | xref:BloombergLP/bdlma/BufferImpUtil/allocateNaturallyAlignedFromBuffer.adoc[`allocateNaturallyAlignedFromBuffer`] | Allocate a naturally‐aligned memory block of the specified `size` (in bytes) from the specified `buffer` having the specified `bufferSize` (in bytes) at the specified `cursor` position. Return the address of the allocated memory block if `buffer` contains sufficient available memory, and 0 otherwise. The `cursor` is set to the first byte position immediately after the allocated memory if there is sufficient memory, and not modified otherwise. The behavior is undefined unless `0 < size`, `0 <= *cursor`, and `*cursor <= bufferSize`. | xref:BloombergLP/bdlma/BufferImpUtil/allocateNaturallyAlignedFromBufferRaw.adoc[`allocateNaturallyAlignedFromBufferRaw`] | Allocate a naturally‐aligned memory block of the specified `size` (in bytes) from the specified `buffer` at the specified `cursor` position. 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`. | xref:BloombergLP/bdlma/BufferImpUtil/allocateOneByteAlignedFromBuffer.adoc[`allocateOneByteAlignedFromBuffer`] | Allocate a 1‐byte‐aligned memory block of the specified `size` (in bytes) from the specified `buffer` having the specified `bufferSize` (in bytes) at the specified `cursor` position. Return the address of the allocated memory block if `buffer` contains sufficient available memory, and 0 otherwise. The `cursor` is set to the first byte position immediately after the allocated memory if there is sufficient memory, and not modified otherwise. The behavior is undefined unless `0 < size`, `0 <= *cursor`, and `*cursor <= bufferSize`. | xref:BloombergLP/bdlma/BufferImpUtil/allocateOneByteAlignedFromBufferRaw.adoc[`allocateOneByteAlignedFromBufferRaw`] | Allocate a 1‐byte‐aligned memory block of the specified `size` (in bytes) from the specified `buffer` at the specified `cursor` position. 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`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#