C
carl
In a program I have a nested switch over 3 variables a, b and c. Now instead
of having this nasty switch (which might grow) I was thinking about creating
a single unique value for each combination of the 3 variables and then
switch on this single varible instead. Something like:
// a, b and c can each range from 0 to n.
int selection = multiplex(a,b,c);
// Single level switch
switch (selection) {
case: 0
....
}
Has anyone done this kind of "multiplexing before" and can recommend an
approach to implement it?
of having this nasty switch (which might grow) I was thinking about creating
a single unique value for each combination of the 3 variables and then
switch on this single varible instead. Something like:
// a, b and c can each range from 0 to n.
int selection = multiplex(a,b,c);
// Single level switch
switch (selection) {
case: 0
....
}
Has anyone done this kind of "multiplexing before" and can recommend an
approach to implement it?