21template <
typename Callable>
class ScopedJanitor {
23 ScopedJanitor(Callable &&c) : _enabled(
true), _c(std::forward<Callable>(c)) {}
30 ScopedJanitor(ScopedJanitor &&rhs) : _c(std::move(rhs._c)) { rhs.disable(); }
32 void disable() { _enabled =
false; }
34 ScopedJanitor(ScopedJanitor
const &rhs) =
delete;
35 ScopedJanitor &operator=(ScopedJanitor
const &rhs) =
delete;
36 ScopedJanitor &operator=(ScopedJanitor &&rhs) =
delete;