Browse Source

Refactoring.

main
offa 7 years ago
parent
commit
2db5ae2ee2
1 changed files with 12 additions and 5 deletions
  1. +12
    -5
      include/unique_resource.h

+ 12
- 5
include/unique_resource.h View File

{ {
if( m_execute_on_destruction == true ) if( m_execute_on_destruction == true )
{ {
try
{
m_deleter(m_resource);
}
catch( ... ) { /* Empty */ }
callDeleterSafe();
} }

m_execute_on_destruction = ( strategy == invoke_it::again ); m_execute_on_destruction = ( strategy == invoke_it::again );
} }


return *this; return *this;
} }



unique_resource_t& operator=(const unique_resource_t&) = delete; unique_resource_t& operator=(const unique_resource_t&) = delete;




private: private:


void callDeleterSafe() noexcept
{
try
{
m_deleter(m_resource);
}
catch( ... ) { /* Empty */ }
}

Ressource m_resource; Ressource m_resource;
Deleter m_deleter; Deleter m_deleter;
bool m_execute_on_destruction; bool m_execute_on_destruction;

Loading…
Cancel
Save