Geant4 11.3.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
PTL::ScopeDestructor Struct Reference

#include <ScopeDestructor.hh>

Public Member Functions

template<typename FuncT>
 ScopeDestructor (FuncT &&_func)
 
 ScopeDestructor (const ScopeDestructor &)=delete
 
ScopeDestructoroperator= (const ScopeDestructor &)=delete
 
 ScopeDestructor (ScopeDestructor &&rhs) noexcept
 
ScopeDestructoroperator= (ScopeDestructor &&rhs) noexcept
 
 ~ScopeDestructor ()
 

Detailed Description

Definition at line 27 of file ScopeDestructor.hh.

Constructor & Destructor Documentation

◆ ScopeDestructor() [1/3]

template<typename FuncT>
PTL::ScopeDestructor::ScopeDestructor ( FuncT && _func)
inline

Definition at line 30 of file ScopeDestructor.hh.

31 : m_functor(std::forward<FuncT>(_func))
32 {}

Referenced by operator=(), operator=(), ScopeDestructor(), and ScopeDestructor().

◆ ScopeDestructor() [2/3]

PTL::ScopeDestructor::ScopeDestructor ( const ScopeDestructor & )
delete

◆ ScopeDestructor() [3/3]

PTL::ScopeDestructor::ScopeDestructor ( ScopeDestructor && rhs)
inlinenoexcept

Definition at line 39 of file ScopeDestructor.hh.

40 : m_functor(std::move(rhs.m_functor))
41 {
42 rhs.m_functor = []() {};
43 }

◆ ~ScopeDestructor()

PTL::ScopeDestructor::~ScopeDestructor ( )
inline

Definition at line 55 of file ScopeDestructor.hh.

55{ m_functor(); }

Member Function Documentation

◆ operator=() [1/2]

ScopeDestructor & PTL::ScopeDestructor::operator= ( const ScopeDestructor & )
delete

◆ operator=() [2/2]

ScopeDestructor & PTL::ScopeDestructor::operator= ( ScopeDestructor && rhs)
inlinenoexcept

Definition at line 45 of file ScopeDestructor.hh.

46 {
47 if(this != &rhs)
48 {
49 m_functor = std::move(rhs.m_functor);
50 rhs.m_functor = []() {};
51 }
52 return *this;
53 }

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