[#BloombergLP-bsltf-StdTestAllocator-05] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bsltf.adoc[bsltf]::StdTestAllocator :relfileprefix: ../../ :mrdocs: 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>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> class StdTestAllocator; ---- == Types [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bsltf/StdTestAllocator-05/rebind.adoc[`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 [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bsltf/StdTestAllocator-05/const_pointer.adoc[`const_pointer`] | Alias for a pointer to `const TYPE`. | xref:BloombergLP/bsltf/StdTestAllocator-05/const_reference.adoc[`const_reference`] | Alias for a reference to `const TYPE`. | xref:BloombergLP/bsltf/StdTestAllocator-05/difference_type.adoc[`difference_type`] | Alias for `bsls::Types::IntPtr`. | xref:BloombergLP/bsltf/StdTestAllocator-05/pointer.adoc[`pointer`] | Alias for a pointer to `TYPE`. | xref:BloombergLP/bsltf/StdTestAllocator-05/reference.adoc[`reference`] | Alias for a reference to `TYPE`. | xref:BloombergLP/bsltf/StdTestAllocator-05/size_type.adoc[`size_type`] | Alias for `bsls::Types::UintPtr`. | xref:BloombergLP/bsltf/StdTestAllocator-05/value_type.adoc[`value_type`] | Alias for the allocated `TYPE`. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bsltf/StdTestAllocator-05/2constructor-0b.adoc[`StdTestAllocator`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bsltf/StdTestAllocator-05/address-0a.adoc[`address`] | `address` overloads | xref:BloombergLP/bsltf/StdTestAllocator-05/allocate.adoc[`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()`. | xref:BloombergLP/bsltf/StdTestAllocator-05/construct.adoc[`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`. | xref:BloombergLP/bsltf/StdTestAllocator-05/deallocate.adoc[`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. | xref:BloombergLP/bsltf/StdTestAllocator-05/destroy.adoc[`destroy`] | Call the `ELEMENT_TYPE` destructor for the object at the specified `address` but do not deallocate the memory at `address`. | xref:BloombergLP/bsltf/StdTestAllocator-05/max_size.adoc[`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. | xref:BloombergLP/bsltf/StdTestAllocator-05/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<StdTestAllocator, IsStdAllocator>`] | Declare `StdTestAllocator` as a standard allocator. |=== == Specializations [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bsltf/StdTestAllocator-0e.adoc[`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 [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bsltf/operator_not_eq-0e.adoc[`operator!=`] | Return `false` because `StdTestAllocator` does not hold a state. | xref:BloombergLP/bsltf/operator_eq-0e5.adoc[`operator==`] | Return `true` because `StdTestAllocator` does not hold a state. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#