Return a pointer to a block of raw memory allocated from the specified allocator having the specified nbytes size and optionally specified alignment. If alignment is not specified, the natural alignment for an object of size nbytes is used. If alignment is larger than the largest supported alignment for t_ALLOCATOR, either the block will be aligned to the maximum supported alignment or an exception will be thrown; the specific choice of behavior is determined by the allocator. For polymorphic allocators the behavior of extended alignment is determined by the memory resource, whereas for non‐polymorphic allocators, the alignment is always truncated to the maximum non‐extended alignment.

Synopsis

Declared in <bslma_allocatorutil.h>

template<class t_ALLOCATOR>
static
AllocatorUtil_Traits<t_ALLOCATOR>::void_pointer
allocateBytes(
    t_ALLOCATOR const& allocator,
    std::size_t nbytes,
    std::size_t alignment = 0);

Created with MrDocs