This allocator implements the minimal interface to comply with section 20.1.5 ([lib.allocator.requirements]) of the C++03 standard. Instances of this allocator delegate their operations to a globally configured delegate allocator as C++03 compliant allocators cannot have individually identifiable state (see StdTestAllocatorConfiguration and 'StdTestAllocatorConfigurationGuard).

Synopsis

Declared in <bsltf_stdtestallocator.h>

template<class TYPE>
class StdTestAllocator;

Types

Name

Description

rebind

This nested struct template, parameterized by some BDE_OTHER_TYPE, provides a namespace for an other type alias, which is an allocator type following the same template as this one but that allocates elements of BDE_OTHER_TYPE. Note that this allocator type is convertible to and from other for any BDE_OTHER_TYPE including void.

Type Aliases

Name

Description

const_pointer

Alias for a pointer to const TYPE.

const_reference

Alias for a reference to const TYPE.

difference_type

Alias for bsls::Types::IntPtr.

pointer

Alias for a pointer to TYPE.

reference

Alias for a reference to TYPE.

size_type

Alias for bsls::Types::UintPtr.

value_type

Alias for the allocated TYPE.

Member Functions

Name

Description

StdTestAllocator [constructor]

Constructors

address

address overloads

allocate

Allocate enough (properly aligned) space for the specified numElements of type T. If the configured delegate allocator is unable to fulfill the allocation request, an exception (typically bsl::bad_alloc) will be thrown. The behavior is undefined unless numElements <= max_size().

construct

Create an object of (template parameter) ELEMENT_TYPE at the specified address, constructed by forwarding the specified argument1 and the (variable number of) additional specified arguments to the corresponding constructor of ELEMENT_TYPE. The behavior is undefined unless address refers to a block of memory having sufficient size and alignment for an object of ELEMENT_TYPE.

deallocate

Return memory previously at the specified address for numElements back to this allocator. The numElements argument is ignored by this allocator type. The behavior is undefined unless address was allocated using this allocator object and has not already been deallocated.

destroy

Call the ELEMENT_TYPE destructor for the object at the specified address but do not deallocate the memory at address.

max_size

Return the maximum number of elements of type TYPE that can be allocated using this allocator in a single call to the allocate method. Note that there is no guarantee that attempts at allocating less elements than the value returned by max_size will not throw.

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

Declare StdTestAllocator as a standard allocator.

Specializations

Name

Description

StdTestAllocator<void>

This specialization of StdTestAllocator for void type as the parameterized TYPE does not contain members that are unrepresentable for void.

Non-Member Functions

Name

Description

operator!=

Return false because StdTestAllocator does not hold a state.

operator==

Return true because StdTestAllocator does not hold a state.

Created with MrDocs