diff options
Diffstat (limited to 'include/cru/base/Guard.h')
| -rw-r--r-- | include/cru/base/Guard.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/cru/base/Guard.h b/include/cru/base/Guard.h index a23e2574..ae120f5a 100644 --- a/include/cru/base/Guard.h +++ b/include/cru/base/Guard.h @@ -43,7 +43,7 @@ inline AutoFreePtr<T> MakeAutoFree(T* ptr) { return AutoFreePtr<T>(ptr); } -template <typename T, void (*DestructFunc)(T value) noexcept> +template <typename T, typename Destructor> class AutoDestruct { public: AutoDestruct() : value_(std::nullopt), auto_destruct_(false) {} @@ -110,7 +110,7 @@ class AutoDestruct { private: void DoDestruct() { if (auto_destruct_ && value_) { - DestructFunc(*value_); + Destructor{}(*value_); } } |
