Return a newly allocated block of at least bytes with alignment.
Synopsis
Declared in <bslma_allocator.h>
virtual
void*
do_allocate(
std::size_t bytes,
std::size_t alignment) override;
Description
Return a newly allocated block of memory of (at least) the specified positive bytes and having at least the specified alignment. Unless overriden in a derived class, the return value is this‐>allocate(bytes). If this allocator cannot return the requested number of bytes or cannot satisfy the alignment request, then it will throw a std::bad_alloc exception in an exception‐enabled build, or else will abort the program in a non‐exception build. Unless overriden in a derived class, this function will forward the allocation request to the allocate virtual function, padding bytes and adjusting the return value as necessary to ensure sufficient alignment. Note that if bytes is 0, the same non‐null value will be returned every time.
Return Value
pointer to the allocated memory block
Parameters
Name |
Description |
bytes |
minimum number of bytes to allocate |
alignment |
minimum alignment of the returned block |
Created with MrDocs