瀏覽代碼

Refactoring.

main
offa 7 年之前
父節點
當前提交
2db5ae2ee2
共有 1 個檔案被更改,包括 12 行新增5 行删除
  1. +12
    -5
      include/unique_resource.h

+ 12
- 5
include/unique_resource.h 查看文件

@@ -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;

Loading…
取消
儲存