Pārlūkot izejas kodu

Refactoring.

main
offa pirms 7 gadiem
vecāks
revīzija
2db5ae2ee2
1 mainītis faili ar 12 papildinājumiem un 5 dzēšanām
  1. +12
    -5
      include/unique_resource.h

+ 12
- 5
include/unique_resource.h Parādīt failu

@@ -62,12 +62,9 @@ namespace sr
{
if( m_execute_on_destruction == true )
{
try
{
m_deleter(m_resource);
}
catch( ... ) { /* Empty */ }
callDeleterSafe();
}

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

@@ -89,11 +86,21 @@ namespace sr
return *this;
}


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


private:

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

Ressource m_resource;
Deleter m_deleter;
bool m_execute_on_destruction;

Notiek ielāde…
Atcelt
Saglabāt