VLink  2.0.0
A high-performance communication middleware
vlink::ObjectPool< T >::PoolDeleter Struct Referencefinal

Custom deleter installed on every RAII handle handed out by get / get_shared. More...

#include <object_pool.h>

Collaboration diagram for vlink::ObjectPool< T >::PoolDeleter:

Public Member Functions

void operator() (T *ptr) const noexcept
 Returns ptr to the pool, or deletes it when the pool is gone. More...
 

Public Attributes

std::weak_ptr< ObjectPool< T > > weak_pool
 Weak reference to the parent pool. More...
 

Detailed Description

template<typename T>
struct vlink::ObjectPool< T >::PoolDeleter

Custom deleter installed on every RAII handle handed out by get / get_shared.

Holds a non-owning weak_ptr to the parent pool. When the handle is destroyed, the deleter either returns the object via release() (when the pool is alive) or falls back to operator delete (when the pool has already been torn down).

Member Function Documentation

◆ operator()()

template<typename T >
void vlink::ObjectPool< T >::PoolDeleter::operator() ( T *  ptr) const
inlinenoexcept

Returns ptr to the pool, or deletes it when the pool is gone.

Parameters
ptrRaw pointer to the object being released; nullptr is silently ignored.

Member Data Documentation

◆ weak_pool

template<typename T >
std::weak_ptr<ObjectPool<T> > vlink::ObjectPool< T >::PoolDeleter::weak_pool

Weak reference to the parent pool.


The documentation for this struct was generated from the following file: