Add another constructor to scoped_restore_current_language

While working on something else, I noticed that this is relatively
common:

  scoped_restore_current_language save;
  set_language (something);

This patch adds a second constructor to
scoped_restore_current_language to simplify this idiom.

Reviewed-By: Tom de Vries <tdevries@suse.de>
This commit is contained in:
Tom Tromey
2024-08-14 11:22:58 -06:00
parent 5c8f918639
commit d47600c85d
6 changed files with 16 additions and 14 deletions

View File

@@ -860,6 +860,10 @@ class scoped_restore_current_language
public:
scoped_restore_current_language ();
/* Set the current language as well. */
explicit scoped_restore_current_language (enum language lang);
~scoped_restore_current_language ();
scoped_restore_current_language (scoped_restore_current_language &&other)