[#BloombergLP-bslma-BufferAllocator-allocateFromBuffer-0a]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::xref:BloombergLP/bslma/BufferAllocator.adoc[BufferAllocator]::allocateFromBuffer
:relfileprefix: ../../../
:mrdocs:

`allocateFromBuffer` overloads

== Synopses

Declared in `&lt;bslma&lowbar;bufferallocator&period;h&gt;`

Allocate a memory block of the specified `size` from `buffer`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
void*
xref:BloombergLP/bslma/BufferAllocator/allocateFromBuffer-06.adoc[allocateFromBuffer](
    int* cursor,
    char* buffer,
    xref:BloombergLP/bslma/Allocator/size_type.adoc[size&lowbar;type] bufSize,
    xref:BloombergLP/bslma/Allocator/size_type.adoc[size&lowbar;type] size,
    xref:BloombergLP/bslma/BufferAllocator/AlignmentStrategy.adoc[AlignmentStrategy] strategy);
----

[.small]#xref:BloombergLP/bslma/BufferAllocator/allocateFromBuffer-06.adoc[_» more&period;&period;&period;_]#

Allocate a memory block of the specified `size` from `buffer` with the specified `alignment`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
void*
xref:BloombergLP/bslma/BufferAllocator/allocateFromBuffer-03.adoc[allocateFromBuffer](
    int* cursor,
    char* buffer,
    xref:BloombergLP/bslma/Allocator/size_type.adoc[size&lowbar;type] bufSize,
    xref:BloombergLP/bslma/Allocator/size_type.adoc[size&lowbar;type] size,
    int alignment);
----

[.small]#xref:BloombergLP/bslma/BufferAllocator/allocateFromBuffer-03.adoc[_» more&period;&period;&period;_]#

== Return Value

address of the allocated block, or null if insufficient space

== Parameters

[cols="1,4"]
|===
| Name| Description
| *cursor*
| Index of the next available byte in `buffer` (in&sol;out)&period;
| *buffer*
| Memory buffer from which to allocate&period;
| *bufSize*
| Size (in bytes) of `buffer`&period;
| *size*
| Number of bytes to allocate&period;
| *strategy*
| Alignment strategy used for the allocation&period;
| *alignment*
| Alignment (in bytes) for the allocated block&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
