Return a newly allocated block of at least size bytes with alignment.
Synopsis
Declared in <bdlma_alignedallocator.h>
virtual
void*
allocateAligned(
bsls::Types::size_type size,
bsls::Types::size_type alignment) = 0;
Description
Return the address of a newly allocated block of memory of at least the specified positive size (in bytes), sufficiently aligned such that the returned address satisfies, for the specified alignment, 0 == (address & (alignment ‐ 1)). If size is 0, a null pointer is returned with no other effect. If the requested number of appropriately aligned bytes cannot be returned, then a bsl::bad_alloc exception is thrown, or in a non‐exception build the program is terminated. The behavior is undefined unless alignment is both a multiple of sizeof(void *) and an integral non‐negative power of two.
Return Value
address of the newly allocated block, or a null pointer if size is 0
Parameters
Name |
Description |
size |
number of bytes to allocate |
alignment |
required alignment of the returned block |
Created with MrDocs