An STL‐compatible allocator that forwards to a bslma::Allocator.

Synopsis

Declared in <bslma_bslallocator.h>

template<class TYPE = polymorphic_allocator<>::value_type>
class allocator
    : public polymorphic_allocator<TYPE>

Description

An STL‐compatible allocator that forwards allocation calls to an underlying mechanism object of a type derived from bslma::Allocator. This class template adheres to the allocator requirements defined in section [allocator.requirements]and implements a superset of the std::pmr::polymorphic_allocator class template described in section [mem.poly.allocator.class]of the C++ standard and may be used to instantiate any [container]class template that follows the STL allocator protocol. The allocation mechanism is chosen at run‐time, giving the programmer run‐time control over how a container allocates and frees memory.

Base Classes

Name

Description

polymorphic_allocator<TYPE>

Alias for std::pmr::polymorphic_allocator in the bsl namespace.

Types

Name

Description

rebind

Rebind this allocator to another type.

Type Aliases

Name

Description

const_pointer

This typedef is an alias to BaseTraits::const_pointer.

const_reference

This typedef is an alias to a constant value_type reference.

const_void_pointer

This typedef is an alias to BaseTraits::const_void_pointer.

difference_type

Difference type for allocations from this allocator.

pointer

This typedef is an alias to BaseTraits::pointer.

reference

This typedef is an alias to a modifiable value_type reference.

size_type

Size type for allocations from this allocator.

value_type

This typedef is an alias to the (template parameter) TYPE.

void_pointer

This typedef is an alias to BaseTraits::void_pointer.

Member Functions

Name

Description

allocator [constructor]

Create an allocator that uses the default allocator mechanism.

allocator [constructor]

Create an allocator that copies original.

allocator [constructor]

Create an allocator sharing the mechanism of the specified original.

allocator [constructor]

Convert a bslma::Allocator pointer to an allocator object.

operator=

Assign this allocator from the specified rhs if it is a no‐op assignment.

address

Return the address of the specified object x.

address

Return the address of the specified object x.

allocate

Return storage for n objects of value_type.

construct

Default‐construct an ELEMENT_TYPE object at the specified address.

construct

Construct an ELEMENT_TYPE at address from the arguments.

construct

Construct an ELEMENT_TYPE at address using perfect forwarding.

deallocate

Deallocate the memory block at the specified p address.

destroy

Call the destructor for the object at the specified address.

max_size

Return the maximum number of elements allocatable by this allocator.

mechanism

Return a pointer to the mechanism object to which this proxy forwards allocation and deallocation calls.

select_on_container_copy_construction

Return a default‐constructed allocator.

operator BloombergLP::bslmf::NestedTraitDeclaration<allocator, IsBitwiseCopyable>

Return a tag declaring that this allocator is bitwise copyable.

operator BloombergLP::bslmf::NestedTraitDeclaration<allocator, IsBitwiseEqualityComparable>

Declare that allocator is bitwise equality comparable.

Specializations

Name

Description

allocator<void>

Specialization of allocator for void.

Non-Member Functions

Name

Description

format

Format args according to fmtStr using alloc and locale loc.

format

Format args according to fmtStr using allocator alloc.

format

Format args according to fmtStr using alloc and locale loc.

format

Format args according to fmtStr using allocator alloc.

vformat

Format args according to fmtStr using allocator and locale.

vformat

Format args according to fmtStr using the given allocator.

vformat

Format args according to fmtStr using the given allocator.

vformat

Format args according to fmtStr using allocator and locale.

::BloombergLP::bslfmt::format

Format args according to fmtStr using allocator alloc.

::BloombergLP::bslfmt::format

Format args according to fmtStr using allocator alloc.

::BloombergLP::bslfmt::vformat

Format args according to fmtStr using the given allocator.

::BloombergLP::bslfmt::vformat

Format args according to fmtStr using the given allocator.

Derived Classes

Name

Description

allocator<void>

Specialization of allocator for void.

Created with MrDocs