Logo Pico-Framework A web-first embedded framework for C++
Loading...
Searching...
No Matches
WithFlag.h
Go to the documentation of this file.
1
15 #pragma once
16
21 class WithFlag {
22 bool& flag;
24
25 public:
31 explicit WithFlag(bool& flag, bool value = true)
33 flag = value;
34 }
35
42 };
43
Temporarily sets a boolean flag and restores it automatically.
Definition WithFlag.h:21
bool & flag
Definition WithFlag.h:22
WithFlag(bool &flag, bool value=true)
Construct the WithFlag and set the flag to the desired value (default true).
Definition WithFlag.h:31
bool previousValue
Definition WithFlag.h:23
~WithFlag()
Destructor restores the original value of the flag.
Definition WithFlag.h:39