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

#include <Utility.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 366 of file Utility.hh.

Constructor & Destructor Documentation

◆ ScopeDestructor() [1/3]

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

Definition at line 369 of file Utility.hh.

370 : m_functor(std::forward<FuncT>(_func))
371 {}

◆ ScopeDestructor() [2/3]

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

◆ ScopeDestructor() [3/3]

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

Definition at line 378 of file Utility.hh.

379 : m_functor(std::move(rhs.m_functor))
380 {
381 rhs.m_functor = []() {};
382 }

◆ ~ScopeDestructor()

PTL::ScopeDestructor::~ScopeDestructor ( )
inline

Definition at line 394 of file Utility.hh.

394{ 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 384 of file Utility.hh.

385 {
386 if(this != &rhs)
387 {
388 m_functor = std::move(rhs.m_functor);
389 rhs.m_functor = []() {};
390 }
391 return *this;
392 }

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