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