summaryrefslogtreecommitdiff
path: root/src/helpers/ScopeGuard.hpp
blob: 8a1468ebf1f75c3a18c377a5949aaa7de097e949 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#pragma once

#include <functional>

// calls a function when it goes out of scope
class CScopeGuard {
  public:
    CScopeGuard(const std::function<void()>& fn_);
    ~CScopeGuard();

  private:
    std::function<void()> fn;
};