Minor one, just saw this code snippet as example in the docs
int x = 1;
{
ScopedValueSetter setter (x, 2);
// x is now 2
}
// x is now 1 again
{
ScopedValueSetter setter (x, 3, 4);
// x is now 3
}
// x is now 4
Isn’t this some C++ 17 magic? I guess in pre-C++ 17 the template type has to be explicitly specified like
ScopedValueSetter<int> setter (...)
– or did I miss something? Might be confusing to newcomers that copy & paste the example code!