How to avoid complex switches?

N

none

void createMyClass (int a, int b, int c, int d)
{
switch ( a ) {
case 1 :
typedef test::Green ColorType;
switch ( b ) {
case 1 :
typedef test::Water MediumType;
switch ( c ) {
case 1 :
typedef test::Linear InterpolationType;
MyClass<ColorTyper, MediumType, InterpolationType >
myClass;
break;

becomes

void createMyClass (int a, int b, int c, int d)
{
switch ( a ) {
case 1 :
switch ( b ) {
case 1 :
switch ( c ) {
DECLARE_MYCLASS(1, test::Green, test::Water, test::Linear)
DECLARE_MYCLASS(2, test::Green, test::Water, test::Foo)
DECLARE_MYCLASS(3, test::Green, test::Water, test::Bar)

I am back to this problem again. In the above example is DECLARE_MYCLASS and
actual class like:

template<typename A, typename B, typename C>
class DECLARE_MYCLASS {


};

and where does 1,2 and 3 come from? From the above switch all values are 1.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top