BloombergLP::bslma::BufferAllocator

Concrete buffer allocator that allocates from a user-supplied fixed-size buffer.

Synopsis

Declared in <bslma_bufferallocator.h>

class BufferAllocator
    : public Allocator

Description

This class provides a concrete buffer allocator that implements the Allocator interface, and allocates memory blocks from a fixed-size buffer that is supplied by the user at construction. The allocator can supply memory that can be maximally (default) or naturally aligned.

Base Classes

NameDescription
AllocatorPure abstract protocol for clients and suppliers of raw memory.

Type Aliases

NameDescription
AllocCallback AllocCallback is an alias for (the address of) a function that takes an integer argument and returns void *.
size_type Alias for an unsigned integral type capable of representing the number of bytes in this platform's virtual address space.

Enums

NameDescription
AlignmentStrategy Types of alignment strategy to allocate memory.

Member Functions

NameDescription
BufferAllocator [constructor]Constructors
~BufferAllocator [destructor] [virtual]Destroy this buffer allocator.
operator=
allocate Return a newly allocated block of memory of the specified size.
deallocate This function has no effect for this buffer allocator.
deleteObject deleteObject overloads
deleteObjectRaw deleteObjectRaw overloads
is_equal
print Write formatted debugging information to stdout describing the internal state of this buffer allocator.

Static Member Functions

NameDescription
allocateFromBuffer allocateFromBuffer overloads
throwBadAlloc Throw std::bad_alloc or abort the program.

Protected Member Functions

NameDescription
do_allocate [virtual]Return a newly allocated block of at least bytes with alignment.
do_deallocate [virtual]Return the memory block at p having bytes and alignment.
do_is_equal [virtual]Return whether this allocator can exchange memory with other.