Open Bug 1963529 Opened 14 days ago Updated 14 days ago

It might be better that a constructor of `AutoRestore` takes new value too

Categories

(Core :: XPCOM, enhancement)

enhancement

Tracking

()

People

(Reporter: masayuki, Unassigned)

Details

Currently, you need to write:

  AutoRestore<bool> restoreFoo(mFoo);
  mFoo = false;

It might be nicer if this can be rewritten as:

  AutoRestore<bool> restoreFoo(mFoo, false);

So, the constructor like this:

AutoRestore(T& aValue, T aNewValue) : mLocation(aValue), mValue(aValue) {
  mLocation = aNewValue;
}
You need to log in before you can comment on or make changes to this bug.