File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed
Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ class FlagStateInterface {
5858 virtual ~FlagStateInterface ();
5959
6060 // Restores the flag originated this object to the saved state.
61- virtual void Restore () const = 0;
61+ virtual void Restore () && = 0;
6262};
6363
6464} // namespace flags_internal
Original file line number Diff line number Diff line change 2626#include < memory>
2727#include < string>
2828#include < typeinfo>
29+ #include < utility>
2930#include < vector>
3031
3132#include " absl/base/attributes.h"
@@ -139,8 +140,8 @@ class FlagState : public flags_internal::FlagStateInterface {
139140 friend class FlagImpl ;
140141
141142 // Restores the flag to the saved state.
142- void Restore () const override {
143- if (!flag_impl_.RestoreState (*this )) return ;
143+ void Restore () && override {
144+ if (!std::move ( flag_impl_) .RestoreState (*this )) return ;
144145
145146 ABSL_INTERNAL_LOG (INFO,
146147 absl::StrCat (" Restore saved value of " , flag_impl_.Name (),
Original file line number Diff line number Diff line change 1919
2020#include < atomic>
2121#include < string>
22+ #include < utility>
2223
2324#include " absl/base/config.h"
2425#include " absl/base/no_destructor.h"
@@ -320,9 +321,9 @@ class FlagSaverImpl {
320321 }
321322
322323 // Restores the saved flag states into the flag registry.
323- void RestoreToRegistry () {
324+ void RestoreToRegistry () && {
324325 for (const auto & flag_state : backup_registry_) {
325- flag_state-> Restore ();
326+ std::move (* flag_state). Restore ();
326327 }
327328 }
328329
@@ -340,7 +341,7 @@ FlagSaver::FlagSaver() : impl_(new flags_internal::FlagSaverImpl) {
340341FlagSaver::~FlagSaver () {
341342 if (!impl_) return ;
342343
343- impl_-> RestoreToRegistry ();
344+ std::move (* impl_). RestoreToRegistry ();
344345 delete impl_;
345346}
346347
You can’t perform that action at this time.
0 commit comments