#pragma once | #pragma once | ||||
#include "scope_exit.h" | |||||
#include <utility> | #include <utility> | ||||
#include <type_traits> | #include <type_traits> | ||||
template<class RR> | template<class RR> | ||||
void reset(RR&& r) | void reset(RR&& r) | ||||
{ | { | ||||
auto se = make_scope_exit([this, &r] { get_deleter()(r); }); | |||||
reset(); | reset(); | ||||
m_resource = move_assign_if_noexcept(r); | m_resource = move_assign_if_noexcept(r); | ||||
m_execute_on_destruction = true; | m_execute_on_destruction = true; | ||||
se.release(); | |||||
} | } | ||||
void release() | void release() |