How should this be done? (1.0)
Christian Kamm
kamm.incasoftware at shift-at-left-and-remove-this.de
Tue Feb 5 22:19:18 PST 2008
What about the old fashioned way:
struct CommonCalculation
{
bool commonBool1;
bool commonBool2;
void calculate()
{
int LocalVal = SomeFn();
commonBool1 = SomeOtherFunc();
commonBool2 = AThirdFunction(LocalVal,commonBool1);
}
}
{
CommonCalculation calc;
calc.calculate();
// do stuff here with calc.commonBool1 and calc.commonBool2
}
You could also make the calculate method a static opCall(), which would
reduce the invocation to the line
CommonCalculation calc = CommonCalculation();
But imho that's not much shorter and less obvious.
Christian Kamm
More information about the Digitalmars-d-learn
mailing list