Destroy object by dynamic type and deallocate its memory.
Synopsis
Declared in <bslma_deleterhelper.h>
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
Name |
Description |
object |
object to destroy and whose memory to deallocate |
allocator |
allocator (or pool) that supplied |
Created with MrDocs