www.mooseframework.org
Public Member Functions | Private Attributes | List of all members
MooseUtils::SharedPool< T >::ExternalDeleter Struct Reference

Public Member Functions

 ExternalDeleter (std::weak_ptr< SharedPool< T > *> pool)
 
void operator() (T *ptr)
 

Private Attributes

std::weak_ptr< SharedPool< T > * > _pool
 

Detailed Description

template<class T>
struct MooseUtils::SharedPool< T >::ExternalDeleter

Definition at line 46 of file SharedPool.h.

Constructor & Destructor Documentation

◆ ExternalDeleter()

template<class T >
MooseUtils::SharedPool< T >::ExternalDeleter::ExternalDeleter ( std::weak_ptr< SharedPool< T > *>  pool)
inlineexplicit

Definition at line 48 of file SharedPool.h.

48 : _pool(pool) {}
std::weak_ptr< SharedPool< T > * > _pool
Definition: SharedPool.h:67

Member Function Documentation

◆ operator()()

template<class T >
void MooseUtils::SharedPool< T >::ExternalDeleter::operator() ( T *  ptr)
inline

Definition at line 50 of file SharedPool.h.

51  {
52  if (auto _poolptr = _pool.lock())
53  {
54  try
55  {
56  (*_poolptr.get())->add(std::unique_ptr<T>{ptr});
57  return;
58  }
59  catch (...)
60  {
61  }
62  }
63  std::default_delete<T>{}(ptr);
64  }
void add(std::unique_ptr< T > t)
Definition: SharedPool.h:76
std::weak_ptr< SharedPool< T > * > _pool
Definition: SharedPool.h:67

Member Data Documentation

◆ _pool

template<class T >
std::weak_ptr<SharedPool<T> *> MooseUtils::SharedPool< T >::ExternalDeleter::_pool
private

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