I need a mechanism that sets the types T1 and T2 , produces the third type T3 , if the pair ( T1 , T2 ) is valid, otherwise a special type Null .
I am currently defining T1 as a class within which I can map a valid set of parameters for T2 to the corresponding T3 .
I am looking for syntax so that a set of valid T2 can be defined inline in the definition of T1 . This is one way to solve the problem using overload resolution:
The task is to handle the case when T2 not found - in the above example, call_member processed. I am trying to avoid the definition of Null S::member(...) .
This example uses decltype , but is there a way to do this in C ++ 03? I am open to any alternative implementations (preferably C ++ 03.)
It would also be possible to implement such a mechanism using explicit specialization, but I am looking for a method that retains the same syntactic structure as in the example, so that it can be expressed as follows:
#define MEMBER(T2, T3) struct S : Base
willj source share