Code:
template <typename C, typename R ,typename Arg1, typename Arg2>
class FunctionWrapper2
{
public:
enum ArgsCounter{ I_C, I_Arg1, I_Arg2, ARGS_COUNT };
struct None;
template<int INDEX, typename S=void>
struct argsType{ typedef None Type; };
template<typename S>
struct argsType<((int) I_C), S>{ typedef C* Type; };
template<typename S>
struct argsType<((int) I_Arg1), S>{ typedef Arg1 Type; };
template<typename S>
struct argsType<((int) I_Arg2), S>{ typedef Arg2 Type; };
};
int main(int argc, char* argv[])
{
typedef FunctionWrapper2<char,int,float,double>::argsType<2,void>::Type TypeofArg2;
TypeofArg2 arg2; // Error C2079: "arg2" using undefined struct "FunctionWrapper2<C, R, Arg1, Arg2>::None"
}