scopeguard.hpp

来自「经典的string 函数库学习资料」· HPP 代码 · 共 29 行

HPP
29
字号
/** * @file ScopeGuard.hpp * @brief ScopeGuard,泥偶做的一些改动,在namespace中声明 * @author 泥偶 * @since  2003-10-15 * @date   2003-10-18 * @note  这个是从 http://www.c-view.org/journal/005/gp_aa.htm 弄来的好东东 */#ifndef SCOPEGUARD_HPP#define SCOPEGUARD_HPPnamespace x{    #include "ScopeGuard.h"    #ifdef __GNUC__    // 重新定义ON_BLOCK_EXIT和ON_BLOCK_EXIT_OBJ,避免编译器抱怨unused variable    #undef ON_BLOCK_EXIT    #define ON_BLOCK_EXIT ScopeGuard __attribute__ ((__unused__)) \        ANONYMOUS_VARIABLE(scopeGuard) = MakeGuard    #undef ON_BLOCK_EXIT_OBJ    #define ON_BLOCK_EXIT_OBJ ScopeGuard __attribute__ ((__unused__)) \        ANONYMOUS_VARIABLE(scopeGuard) = MakeObjGuard    #endif  // __GNUC__}   // namespace x#endif  // ifndef SCOPEGUARD_HPP

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?