[#bsl-allocator-0ac] = xref:bsl.adoc[bsl]::xref:bsl/allocator-0df.adoc[allocator]<void> :relfileprefix: ../ :mrdocs: Specialization of `allocator<T>` where `T` is `void`. Does not contain members that are unrepresentable for `void`. Note that this specialization may be removed in the future. Use `allocator<>` or `allocator<char>` instead. == Synopsis Declared in `<bslma_bslallocator.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<> class xref:bsl/allocator-0df.adoc[allocator]<void> : public xref:bsl/allocator-0df.adoc[allocator<BloombergLP::bslma::BslAllocator_Voidish>] ---- == Base Classes [cols="1,4"] |=== | Name| Description | `xref:bsl/allocator-0df.adoc[allocator<BloombergLP::bslma::BslAllocator_Voidish>]` | 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. |=== == Types [cols="1,4"] |=== | Name| Description | xref:bsl/allocator-0ac/rebind.adoc[`rebind`] | This nested `struct` template, parameterized by `ANY_TYPE`, provides a namespace for an `other` type alias, which is this template instantiated with `ANY_TYPE` instead of `TYPE`. Note that this allocator type is convertible to and from `other` for any type, including `void`. |=== == Type Aliases [cols="1,4"] |=== | Name| Description | xref:bsl/allocator-0ac/const_pointer.adoc[`const_pointer`] | | xref:bsl/allocator-0ac/const_reference.adoc[`const_reference`] | This `typedef` is an alias to a constant `value_type` reference. | xref:bsl/allocator-0ac/const_void_pointer.adoc[`const_void_pointer`] | | xref:bsl/allocator-0ac/difference_type.adoc[`difference_type`] | Difference type for allocations from this allocator. | xref:bsl/allocator-0ac/pointer.adoc[`pointer`] | | xref:bsl/allocator-0ac/reference.adoc[`reference`] | This `typedef` is an alias to a modifiable `value_type` reference. | xref:bsl/allocator-0ac/size_type.adoc[`size_type`] | Size type for allocations from this allocator. | xref:bsl/allocator-0ac/value_type.adoc[`value_type`] | | xref:bsl/allocator-0ac/void_pointer.adoc[`void_pointer`] | |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:bsl/allocator-0ac/2constructor-0c.adoc[`allocator`] [.small]#[constructor]# | Constructors | xref:bsl/allocator-0ac/operator_assign.adoc[`operator=`] | Modify this allocator to use the same mechanism as the specified `rhs` allocator and return a modifiable reference to this object. Note that `bsl::allocator` objects should never be assigned at runtime, but, in the absence of `if constexpr`, such assignments can sometimes be found legitimately in dead branches (branches that are never taken at runtime) within function templates; ideally, such code would be replaced by more sophisticated metaprogramming that avoided calls to this operator entirely. Invoking this assignment will result in a review error unless `rhs == *this`, i.e., when the assignment would be a no‐op. In the future, the review error may be replaced with an a hard assertion failure. | xref:bsl/allocator-0ac/address-071.adoc[`address`] | Return the address of the object referred to by the specified `x` reference, even if the (template parameter) `TYPE` overloads the unary `operator&`. | xref:bsl/allocator-0ac/allocate.adoc[`allocate`] | | xref:bsl/allocator-0ac/construct-09.adoc[`construct`] | `construct` overloads | xref:bsl/allocator-0ac/deallocate.adoc[`deallocate`] | Deallocate a block of memory at the specified `p` address by returning it to the memory resource held by this allocator. Optionally specify the number of objects, `n`, to deallocate. The behavior is undefined unless `p` is the address of a block previously allocated by a call to `allocate` with the same `n` from a copy of this allocator having the same `value_type` and not yet deallocated. | xref:bsl/allocator-0ac/destroy.adoc[`destroy`] | Call the `TYPE` destructor for the object pointed to by the specified `address`. Do not directly deallocate any memory. | xref:bsl/allocator-0ac/max_size.adoc[`max_size`] | | xref:bsl/allocator-0ac/mechanism.adoc[`mechanism`] | Return a pointer to the mechanism object to which this proxy forwards allocation and deallocation calls. | xref:bsl/allocator-0ac/select_on_container_copy_construction.adoc[`select_on_container_copy_construction`] | Return a default‐constructed allocator. | xref:bsl/allocator-0ac/2conversion-0f.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<allocator<BslAllocator_Voidish>, IsBitwiseEqualityComparable>`] | | xref:bsl/allocator-0ac/2conversion-06.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<allocator<void>, IsBitwiseEqualityComparable>`] | |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#