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

Synopsis

Declared in <bslma_stdtestallocator.h>

template<class TYPE>
class StdTestAllocator;

Description

This class template forwards allocation calls to an underlying mechanism object of a type derived from bslma::TestAllocator. It adheres to the allocator requirements defined in section 20.1.5 [lib.allocator.requirements]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.

Types

Name

Description

rebind

Rebind this allocator to another type.

Type Aliases

Name

Description

const_pointer

Alias for a pointer to constant value type.

const_reference

Alias for a constant reference to the value type.

difference_type

Alias for the allocator difference type.

pointer

Alias for a pointer to the value type.

reference

Alias for a modifiable reference to the value type.

size_type

Alias for the allocator size type.

value_type

Alias for the value type.

Member Functions

Name

Description

StdTestAllocator [constructor]

Constructors

address

Return the address of the object referred to by the specified x.

allocate

Allocate space for the specified n objects of type TYPE.

construct

Copy‐construct an object of type TYPE at the specified address.

deallocate

Return memory previously allocated with allocate.

destroy

Destroy the object at the specified address.

max_size

Return the maximum number of TYPE elements this allocator can allocate.

mechanism

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

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

Declare StdTestAllocator as bitwise copyable.

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

Declare StdTestAllocator as bitwise equality comparable.

operator BloombergLP::bslmf::NestedTraitDeclaration<StdTestAllocator, IsBitwiseMoveable>

Declare StdTestAllocator as bitwise moveable.

operator BloombergLP::bslmf::NestedTraitDeclaration<StdTestAllocator, IsStdAllocator>

Declare StdTestAllocator as an STL‐compatible allocator.

Non-Member Functions

Name

Description

operator!=

Return true unless lhs and rhs share the same mechanism.

operator!=

Return true unless the specified lhs is a proxy for rhs.

operator==

Return true if the specified lhs and rhs are proxies for the same bslma::TestAllocator object.

operator==

Return true if the specified lhs is a proxy for the specified rhs.

Created with MrDocs