From 477aecec019dbf32a8142e20b3697edc4eaf57f5 Mon Sep 17 00:00:00 2001 From: Jeremy Rifkin <51220084+jeremy-rifkin@users.noreply.github.com> Date: Thu, 20 Feb 2025 22:22:46 -0600 Subject: [PATCH] Add guard on forwarding constructor --- src/utils/utils.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/utils.hpp b/src/utils/utils.hpp index fead205..afdd9f8 100644 --- a/src/utils/utils.hpp +++ b/src/utils/utils.hpp @@ -283,7 +283,10 @@ namespace detail { F f; bool active; public: - template + template< + typename G, + typename std::enable_if::type, scope_guard>::value, int>::type = 0 + > scope_guard(G&& f) : f(std::forward(f)), active(true) {} ~scope_guard() { if(active) {