bsl::allocator<void>

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>

template<>
class allocator<void>
    : public allocator<BloombergLP::bslma::BslAllocator_Voidish>

Base Classes

NameDescription
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

NameDescription
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

NameDescription
const_pointer
const_reference This typedef is an alias to a constant value_type reference.
const_void_pointer
difference_type Difference type for allocations from this allocator.
pointer
reference This typedef is an alias to a modifiable value_type reference.
size_type Size type for allocations from this allocator.
value_type
void_pointer

Member Functions

NameDescription
allocator [constructor]Constructors
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.
address Return the address of the object referred to by the specified x reference, even if the (template parameter) TYPE overloads the unary operator&.
allocate
construct construct overloads
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.
destroy Call the TYPE destructor for the object pointed to by the specified address. Do not directly deallocate any memory.
max_size
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<BslAllocator_Voidish>, IsBitwiseEqualityComparable>
operator BloombergLP::bslmf::NestedTraitDeclaration<allocator<void>, IsBitwiseEqualityComparable>