CalcSaver

This struct allows to not execute some code if some variables was not changed since the last check. Used for optimizations.

Reference types, arrays and pointers are compared by reference.

Members

Functions

check
bool check(Params args)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

values
Tuple!Params values;
Undocumented in source.

Examples

class A { }

CalcSaver!(uint, double[], A) saver;

uint x = 5;
double[] arr = [1, 2, 3];
A a = new A();

assert(saver.check(x, arr, a));
// values are not changing
assert(!saver.check(x, arr, a));
assert(!saver.check(x, arr, a));
assert(!saver.check(x, arr, a));
assert(!saver.check(x, arr, a));

x = 8;
arr ~= 25;
a = new A();
// values are changed
assert(saver.check(x, arr, a));
assert(!saver.check(x, arr, a));

Meta