Deallocate raw storage previously allocated by allocateObject.

Synopsis

Declared in <bslma_allocatorutil.h>

template<
    class t_ALLOCATOR,
    class t_POINTER>
static
void
deallocateObject(
    t_ALLOCATOR const& allocator,
    t_POINTER p,
    std::size_t n = 1);

Description

Return to the specified allocator a block of raw memory at the specified p address that is suitably sized and aligned to hold an object of (templatize parameter) t_TYPE. Optionally specify n for the number of objects; otherwise a single object is assumed. The behavior is undefined unless p refers to a block with the same type and number of objects previously allocated from a copy of allocator and not yet deallocated.

Parameters

Name

Description

allocator

allocator to which to return the memory

p

address of the block to deallocate

n

number of objects the block was sized for

Created with MrDocs