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.

Synopsis

Declared in <bdlma_alignedallocator.h>

virtual
void*
allocateAligned(
    bsls::Types::size_type size,
    bsls::Types::size_type alignment) = 0;

Created with MrDocs