VLink 2.0.0
A high-performance communication middleware
Loading...
Searching...
No Matches
vlink::ObjectPool< T >::PoolDeleter Struct Referencefinal

Custom deleter for RAII handles returned by get() and 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 if the pool is gone.

Public Attributes

std::weak_ptr< ObjectPool< T > > weak_pool
 Non-owning reference to the parent pool.

Detailed Description

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

Custom deleter for RAII handles returned by get() and get_shared().

Holds a weak_ptr to the parent pool. On destruction of the RAII handle, operator() is called:

  • If the pool is still alive, the object is returned to it via release().
  • If the pool has been destroyed, the object is deleted with delete.

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 if the pool is gone.

Parameters
ptrRaw pointer to the object being released. Ignored if nullptr.

Member Data Documentation

◆ weak_pool

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

Non-owning reference to the parent pool.


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