Iterate over variable member set?
Hi,
I have:
type
TSimulation = (Original, AntiThetic, MatchMoment); { plus more...}
TSimulationSet = set of TSimulation;
var
Sim : TSimulationSet;
counter : TSimulation;
begin
Sim := [Original, MatchMoment];
for counter := Low(TSimulation) to High(TSimulation) do
begin
if not (counter in Sim) then
continue; { only operate on the set as described by Sim !!}
case counter of
Original: fill vector;
AntiThetic: transform vector;
{AntiThetic relies on calculations made by Original}
MatchMoment: transform vector (if exists)
{ perform calculation - the same for Original, AntiThetic etc..}
What would be a more efficient way to iterate over the set described
by "Sim" while still retaining the elegance (IMO this is rather
elegant)?
This would be somewhat in the spirit of:
for counter := low(Sim) to High(Sim) {which does not work}
--
Stefan.Hoffmeis...@Uni-Passau.de
http://www.rz.uni-passau.de/~w4hoff01/
University of Passau, Bavaria, Germany