[#BloombergLP-bslma-DeleterHelper-deleteObject] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslma.adoc[bslma]::xref:BloombergLP/bslma/DeleterHelper.adoc[DeleterHelper]::deleteObject :relfileprefix: ../../../ :mrdocs: Destroy `object` by dynamic type and deallocate its memory. == Synopsis Declared in `<bslma_deleterhelper.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class TYPE, class ALLOCATOR> static void deleteObject( TYPE const* object, ALLOCATOR* allocator); ---- == Description Destroy the specified `object` based on its dynamic type and then use the specified `allocator` to deallocate its memory footprint. Do nothing if `object` is a null pointer. The behavior is undefined unless `allocator` is non‐null, and `object`, when cast appropriately to `void *`, was allocated using `allocator` and has not already been deallocated. Note that `dynamic_cast<void *>(object)` is applied if `TYPE` is polymorphic, and `static_cast<void *>(object)` is applied otherwise. == Parameters [cols="1,4"] |=== | Name| Description | *object* | object to destroy and whose memory to deallocate | *allocator* | allocator (or pool) that supplied `object`'s memory |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#