0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd::util: Prevent scope copying / minor cleanup.

This commit is contained in:
Jason Volk 2016-09-11 20:46:16 -07:00
parent 5b607b5b1f
commit a4e810d1c8

View file

@ -74,17 +74,23 @@ struct scope
{
const std::function<void ()> func;
template<class F> scope(F &&func);
scope(const scope &) = delete;
~scope() noexcept;
};
template<class F>
scope(F &&func)
scope::scope(F &&func)
:func(std::forward<F>(func))
{
}
~scope()
inline
scope::~scope()
noexcept
{
func();
}
};
// For conforming enums include a _NUM_ as the last element,