ACE 8.0.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
ACE_Utils::Auto_Functor< X, Functor > Class Template Reference

Helper template to implement auto_ptr<>-like classes, but executing a functor in the destructor, instead of always deleting things. More...

#include <Auto_Functor.h>

Public Types

typedef X element_type
 
typedef Functor functor_type
 

Public Member Functions

 Auto_Functor (X *p=nullptr, Functor functor=Functor())
 Constructor.
 
 Auto_Functor (Auto_Functor &rhs)
 
Auto_Functor< X, Functor > & operator= (Auto_Functor &rhs)
 
template<typename Y >
 Auto_Functor (Auto_Functor< Y, Functor > &rhs)
 
template<typename Y >
Auto_Functor< X, Functor > & operator= (Auto_Functor< Y, Functor > &rhs)
 
 ~Auto_Functor ()
 
Xoperator* () const
 
Xoperator-> () const
 
Xget ()
 
Xrelease ()
 
void reset (X *p=nullptr)
 
void reset (X *p, Functor f)
 
Functor const & functor () const
 
 Auto_Functor (Auto_Functor_Ref< X, Functor > rhs)
 
Auto_Functor< X, Functor > & operator= (Auto_Functor_Ref< X, Functor > rhs)
 
template<typename Y >
 operator Auto_Functor_Ref< Y, Functor > ()
 
template<typename Y >
 operator Auto_Functor< Y, Functor > ()
 
template<typename Y >
ACE_Utils::Auto_Functor< X, Functor > & operator= (Auto_Functor< Y, Functor > &rhs)
 

Private Attributes

Xp_
 
Functor f_
 

Detailed Description

template<typename X, typename Functor>
class ACE_Utils::Auto_Functor< X, Functor >

Helper template to implement auto_ptr<>-like classes, but executing a functor in the destructor, instead of always deleting things.

The functor is called in the destructor, and it must implement:

Functor() noexcept;
Functor(Functor const &) noexcept;
Functor & operator=(Functor const &) noexcept;
void operator()(X * p) noexcept;

Member Typedef Documentation

◆ element_type

◆ functor_type

Constructor & Destructor Documentation

◆ Auto_Functor() [1/4]

template<typename X , typename Functor >
ACE_Utils::Auto_Functor< X, Functor >::Auto_Functor ( X * p = nullptr,
Functor functor = Functor() )
inlineexplicit

Constructor.

◆ Auto_Functor() [2/4]

template<typename X , typename Functor >
ACE_Utils::Auto_Functor< X, Functor >::Auto_Functor ( Auto_Functor< X, Functor > & rhs)
inline

◆ Auto_Functor() [3/4]

template<typename X , typename Functor >
template<typename Y >
ACE_Utils::Auto_Functor< X, Functor >::Auto_Functor ( Auto_Functor< Y, Functor > & rhs)
inline

◆ ~Auto_Functor()

◆ Auto_Functor() [4/4]

template<typename X , typename Functor >
ACE_Utils::Auto_Functor< X, Functor >::Auto_Functor ( Auto_Functor_Ref< X, Functor > rhs)
inline

Member Function Documentation

◆ functor()

template<typename X , typename Functor >
Functor const & ACE_Utils::Auto_Functor< X, Functor >::functor ( ) const
inline

◆ get()

template<typename X , typename Functor >
X * ACE_Utils::Auto_Functor< X, Functor >::get ( )
inline

◆ operator Auto_Functor< Y, Functor >()

◆ operator Auto_Functor_Ref< Y, Functor >()

◆ operator*()

template<typename X , typename Functor >
X & ACE_Utils::Auto_Functor< X, Functor >::operator* ( ) const
inline

◆ operator->()

template<typename X , typename Functor >
X * ACE_Utils::Auto_Functor< X, Functor >::operator-> ( ) const
inline

◆ operator=() [1/4]

◆ operator=() [2/4]

◆ operator=() [3/4]

◆ operator=() [4/4]

◆ release()

template<typename X , typename Functor >
X * ACE_Utils::Auto_Functor< X, Functor >::release ( )
inline

◆ reset() [1/2]

template<typename X , typename Functor >
void ACE_Utils::Auto_Functor< X, Functor >::reset ( X * p,
Functor f )

◆ reset() [2/2]

Member Data Documentation

◆ f_

◆ p_

template<typename X , typename Functor >
X* ACE_Utils::Auto_Functor< X, Functor >::p_
private

The documentation for this class was generated from the following files: