Suppose I have the following code that I wish to refactor:
int toFuture() { precalc(); int calc = 5 * foobar_x() + 3; postcalc(); return calc; } int toP
I'd say you're refactoring from the wrong side:
struct CalcGuard { CalcGuard() { /* replaces precalc() */ } ~CalcGuard() { /* replaces postcalc() */ } }; int toFuture() { return CalcGuard(), calc = 5 * foobar_x() + 3; } int toPast() { return CalcGuard(), calc = 5 * foobar_y() - 9; }