MADNESS
version 0.9
|
Deferred deleter for smart pointers. More...
#include <deferred_cleanup.h>
Public Member Functions | |
DeferredDeleter (World &w, deleterT d=default_deleter< deleterT >()) | |
Constructs a deferred deleter object. More... | |
DeferredDeleter (const DeferredDeleter< ptrT, deleterT > &other) | |
Copy constructor. More... | |
DeferredDeleter< ptrT, deleterT > & | operator= (const DeferredDeleter< ptrT, deleterT > &other) |
Copy assignment operator. More... | |
void | operator() (ptrT *p) const |
The deferred deletion function. More... | |
Static Public Member Functions | |
template<typename D > | |
static enable_if< std::is_same < D, void(*)(ptrT *)>, D > ::type | default_deleter () |
Construct a default deleter for a function pointer. More... | |
template<typename D > | |
static disable_if < std::is_same< D, void(*)(ptrT *)> , D >::type | default_deleter () |
Construct a default deleter for a functor. More... | |
Deferred deleter for smart pointers.
This deleter object places the shared pointer on the deferred deletion list of a world when the last reference to the pointer is destroyed. Once the pointer is placed in the deferred deletion list, it is destroyed by the world object at the next global fence of that world. You may pass any arbitrary deleter function pointer/functor to to the DeferredDeleter constructor to handle cleanup. If no deleter function pointer/functor is provided by the user, the pointer will be freed with the delete
operator.
ptrT | The pointer type that will be deleted |
deleterT | The deleter function pointer/functor type that will be use to cleanup the pointer [Default = void(*)(ptrT*) ]. |
|
inline |
Constructs a deferred deleter object.
The deleter function pointer d
will be used to delete the pointer at a global fence of world w
.
w | A reference to the world object, which will be responsible for pointer deletion. |
d | A deleter function pointer/functor [Default = if D == void(*) (ptrT*) then d = &detail::checked_delete<ptrT> else d = D() ]. |
|
inline |
Copy constructor.
other | The deleter object to be copied. |
|
inlinestatic |
Construct a default deleter for a function pointer.
|
inlinestatic |
Construct a default deleter for a functor.
|
inline |
The deferred deletion function.
This function is called when the last reference to the shared pointer is destroyed. It will place the pointer in the deferred cleanup list of world.
References madness::detail::DeferredCleanup::add().
|
inline |
Copy assignment operator.
other | The deleter object to be copied. |