diff --git a/include/ircd/util.h b/include/ircd/util.h index 1f8bdb473..dcda94666 100644 --- a/include/ircd/util.h +++ b/include/ircd/util.h @@ -74,18 +74,24 @@ struct scope { const std::function func; - template - scope(F &&func) - :func(std::forward(func)) - { - } - - ~scope() - { - func(); - } + template scope(F &&func); + scope(const scope &) = delete; + ~scope() noexcept; }; +template +scope::scope(F &&func) +:func(std::forward(func)) +{ +} + +inline +scope::~scope() +noexcept +{ + func(); +} + // For conforming enums include a _NUM_ as the last element, // then num_of() works