| 241 | { |
| 242 | public: |
| 243 | RecursionGuard(bool* lock) : lock{lock && !*lock ? lock : nullptr} |
| 244 | { |
| 245 | if (this->lock) *this->lock = true; |
| 246 | } |
| 247 | |
| 248 | RecursionGuard(RecursionGuard&& other) : RecursionGuard{other.take()} {} |
| 249 | ~RecursionGuard() { if (this->lock) *this->lock = false; } |