Fix scope_guard forwarding

This commit is contained in:
Jeremy Rifkin 2025-02-20 22:04:07 -06:00
parent 9b02fc6f74
commit 5bfcf280a5
No known key found for this signature in database
GPG Key ID: 19AA8270105E8EB4

View File

@ -283,7 +283,8 @@ namespace detail {
F f; F f;
bool active; bool active;
public: public:
scope_guard(F&& f) : f(std::forward<F>(f)), active(true) {} template<typename G>
scope_guard(G&& f) : f(std::forward<F>(f)), active(true) {}
~scope_guard() { ~scope_guard() {
if(active) { if(active) {
f(); f();