Creating rapid function overloads in C++
<pre><code>template&lt;typename Functor, typename Return, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5, typename Arg6,
                typename Arg7, typename Arg8, typename Arg9, typename Arg10&gt; class LambdaCall : public Instruction {
                public:
                    LambdaCall(Functor func
                        ,unsigned char constructorarg1
                        ,unsigned char constructorarg2
                        ,unsigned char constructorarg3
                        ,unsigned char constructorarg4
                        ,unsigned char constructorarg5
                        ,unsigned char constructorarg6
                        ,unsigned char constructorarg7
                        ,unsigned char constructorarg8
                        ,unsigned char constructorarg9
                        ,unsigned char constructorarg10)
                        : arg1(constructorarg1)
                        , arg2(constructorarg2)
                        , arg3(constructorarg3)
                        , arg4(constructorarg4)
                        , arg5(constructorarg5)
                        , arg6(constructorarg6)
                        , arg7(constructorarg7)
                        , arg8(constructorarg8)
                        , arg9(constructorarg9)
                        , arg10(constructorarg10)
                        , function(func) {}
                    void Call(State&amp; state) {
                        state.Push&lt;Return&gt;(func(*state.GetRegisterValue&lt;Arg1&gt;(arg1)
                            ,*state.GetRegisterValue&lt;Arg1&gt;(arg1)
                            ,*state.GetRegisterValue&lt;Arg2&gt;(arg2)
                            ,*state.GetRegisterValue&lt;Arg3&gt;(arg3)
                            ,*state.GetRegisterValue&lt;Arg4&gt;(arg4)
                            ,*state.GetRegisterValue&lt;Arg5&gt;(arg5)
                            ,*state.GetRegisterValue&lt;Arg6&gt;(arg6)
                            ,*state.GetRegisterValue&lt;Arg7&gt;(arg7)
                            ,*state.GetRegisterValue&lt;Arg8&gt;(arg8)
                            ,*state.GetRegisterValue&lt;Arg9&gt;(arg9)
                            ,*state.GetRegisterValue&lt;Arg10&gt;(arg10)
                         ));
                    }
                    Functor function;
                    unsigned char arg1;
                    unsigned char arg2;
                    unsigned char arg3;
                    unsigned char arg4;
                    unsigned char arg5;
                    unsigned char arg6;
                    unsigned char arg7;
                    unsigned char arg8;
                    unsigned char arg9;
                    unsigned char arg10;
            };
</code></pre>

<p>Then again for every possible number of arguments I want to support, and again for void returns.</p>

<p>Any way to do this faster?</p>

<p>Edit:
Apparently there's some (understandable) confusion about the goal of the above function.</p>

<p>I want to create a function that accepts N template arguments, has N unsigned char variables, accepts them in it's constructor and assigns them, calls a specific function with the Nth template and Nth char arguments, and passes the return into a given lamba function, which then passes it's return into the last function, which has a special template argument.<br>
Then I want this to work for any given quantity of arguments or void returns.
Preferably without writing an overload for every single argument number and void return possibility, since that would involve 22 specializations.<br>
Edit: Without variadics, not any given quantity, but up to say ten.
I checked out the Boost preprocessor library, but it's not working.</p>
