diff --git a/src/core/backup_type.hpp b/src/core/backup_type.hpp index 23beedefb4..cce6ddb8d1 100644 --- a/src/core/backup_type.hpp +++ b/src/core/backup_type.hpp @@ -144,6 +144,8 @@ private: const int line; }; +struct AutoRestoreBackupNoNewValueTag {}; + /** * Class to backup a specific variable and restore it upon destruction of this object to prevent * stack values going out of scope before resetting the global to its original value. Contrary to @@ -157,6 +159,13 @@ struct AutoRestoreBackup { * the whole goal and reason for existing of this object. */ + /** + * Backup variable. + * @param original Variable to backup. + * @param tag Tag to indicate that the variable's value should not be changed. + */ + AutoRestoreBackup(T &original, AutoRestoreBackupNoNewValueTag tag) : original(original), original_value(original) {} + /** * Backup variable and switch to new value. * @param original Variable to backup.