Bond 0.9
C++ Bond Runtime Library API Documentation
Loading...
Searching...
No Matches
Bond::Allocator::ObjectDeallocator< T > Struct Template Reference

A custom unique_ptr deleter that destroys an object by calling its destructor then freeing its memory by calling Allocator::Free rather than the delete operator. More...

#include <bond/systems/allocator.h>

Public Member Functions

 ObjectDeallocator (Allocator *allocator=nullptr)
 Constructs an ObjectDeallocator object.
void operator() (T *ptr)
 Destroys the given object and frees its memory by calling Allocator::Free.

Public Attributes

Allocator * mAllocator
 The allocator that frees the memory.

Detailed Description

template<typename T>
struct Bond::Allocator::ObjectDeallocator< T >

A custom unique_ptr deleter that destroys an object by calling its destructor then freeing its memory by calling Allocator::Free rather than the delete operator.

Constructor & Destructor Documentation

◆ ObjectDeallocator()

template<typename T>
Bond::Allocator::ObjectDeallocator< T >::ObjectDeallocator ( Allocator * allocator = nullptr)
inlineexplicit

Constructs an ObjectDeallocator object.

Parameters
allocatorThe allocator that frees the memory. If null, the object is neither destroyed nor freed.

Member Function Documentation

◆ operator()()

template<typename T>
void Bond::Allocator::ObjectDeallocator< T >::operator() ( T * ptr)
inline

Destroys the given object and frees its memory by calling Allocator::Free.

Member Data Documentation

◆ mAllocator

template<typename T>
Allocator* Bond::Allocator::ObjectDeallocator< T >::mAllocator

The allocator that frees the memory.


The documentation for this struct was generated from the following file:
  • include/bond/systems/allocator.h