[#bsl-allocator_traits-0108-destroy] = xref:bsl.adoc[bsl]::xref:bsl/allocator_traits-0108.adoc[allocator_traits]::destroy :relfileprefix: ../../ :mrdocs: Destroy the `ELEMENT_TYPE` object at `elementAddr`. == Synopsis Declared in `<bslma_allocatortraits.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class ELEMENT_TYPE> static void destroy( ALLOCATOR_TYPE& basicAllocator, ELEMENT_TYPE* elementAddr); ---- == Description Destroy the object of (template parameter) type `ELEMENT_TYPE` at the specified `elementAddr`, either by 1) calling the `destroy` method on `basicAllocator` with `elemAddr` as the sole argument if the (template parameter) type `ALLOCATOR_TYPE` defines such a method, or 2) calling the destructor directly on `elementAddr` (and ignoring `basicAllocator`) otherwise. The behavior is undefined unless `elementAddr` refers to a valid, constructed object. == Parameters [cols="1,4"] |=== | Name| Description | *basicAllocator* | allocator used for destruction if it provides `destroy` | *elementAddr* | address of the object to destroy |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#