关键词:
class ExecuteOnExit
public:
ExecuteOnExit() = default;
// movable
ExecuteOnExit(ExecuteOnExit&& ) = default;
ExecuteOnExit& operator=(ExecuteOnExit&& ) = default;
// non copyable
ExecuteOnExit(const ExecuteOnExit& e) = delete;
void operator=(const ExecuteOnExit& f) = delete;
template <typename F, typename... Args>
ExecuteOnExit(F&& f, Args&&... args)
func_ = std::bind(std::forward<F>(f), std::forward<Args>(args)...);
~ExecuteOnExit() noexcept
if (func_) func_();
private:
std::function<void ()> func_;
;
#define _CONCAT(a,b) a##b
#define _MAKE_DEFER(line) ExecuteOnExit _CONCAT(defer,line) = [&]()
#define DEFER _MAKE_DEFER(__LINE__)
c_cpp^(代码片段)
查看详情
c_cpp最后的片段(代码片段)
查看详情
c_cpp代码信号08(代码片段)
查看详情
c_cpp幽灵示例代码(代码片段)
查看详情
c_cpp幽灵示例代码(代码片段)
查看详情
c_cpp游戏代码注入(代码片段)
查看详情
c_cpp界()(代码片段)
查看详情
c_cpp输入(代码片段)
查看详情
c_cpp分类(代码片段)
查看详情
c_cpp访问(代码片段)
查看详情
c_cpp填()(代码片段)
查看详情
c_cpp阵列(代码片段)
查看详情
c_cpp功能(代码片段)
查看详情
c_cpp包括(代码片段)
查看详情
c_cpp冒泡(代码片段)
查看详情
c_cpp向量(代码片段)
查看详情
c_cpp加(代码片段)
查看详情
c_cpp测试(代码片段)
查看详情