|
libxr
Embedded C++ framework for bare-metal, RTOS and Linux
|
作用域标志管理器:构造时写入指定值,析构时恢复原值 / Scoped flag restorer: set on entry, restore on exit More...
#include <flag.hpp>
Public Member Functions | |
| ScopedRestore (FlagT &flag, bool set_value=true) | |
| 构造函数:写入 set_value 并保存旧值 / Constructor: set set_value and store previous value | |
| ~ScopedRestore () | |
| 析构函数:恢复旧值 / Destructor: restore previous value | |
| ScopedRestore (const ScopedRestore &)=delete | |
| 禁用拷贝构造与拷贝赋值 / Copy construction and copy assignment are disabled | |
| ScopedRestore & | operator= (const ScopedRestore &)=delete |
作用域标志管理器:构造时写入指定值,析构时恢复原值 / Scoped flag restorer: set on entry, restore on exit
适用于“进入作用域临时改变 flag,退出恢复”的场景。 Useful when temporarily changing a flag within a scope and restoring it on exit.
| FlagT | 支持 Exchange(bool)->bool 的标志类型 / Flag type that provides Exchange(bool)->bool |
|
inlineexplicit |
|
inline |