Partial Specialization of a variadic template function
<p>I have this function which should work recursively. </p>

<pre><code>template &lt;class C, typename ...Arguments&gt;
void addStyleClassRecursive(C *c, Arguments... arg)
{        
    c-&gt;addStyleClass(arg...);
    for (unsigned int i=0; i&lt;c-&gt;children().size(); ++i)
    {
        addStyleClassRecursive(c-&gt;children()[i], arg...);
    }       
}
</code></pre>

<p>Now it happens that at some point I hit a class (<code>Wt::WObject</code>) which has not the <code>addStyleClass</code> member function, so the compiler complains -rightly- about this problem.
Ok. So I thought to specialize the code, adding a version for <code>Wt::WObject</code>:</p>

<pre><code>template &lt;class C=Wt::WObject, typename ...Arguments&gt;
void addStyleClassRecursive(Wt::WObject *c, Arguments... arg)
{
    for (unsigned int i=0; i&lt;c-&gt;children().size(); ++i)
    {
        addStyleClassRecursive(c-&gt;children()[i], arg...);
    }
}
</code></pre>

<p>This doesn't give a compiler error in itself, but it is utterly ignored (indeed the compiler keeps complaining about <code>WObject</code> not having the required member function, pointing to the same line within the general function).</p>

<p>So I tried to specialize it in this way</p>

<pre><code>template &lt;typename ...Arguments&gt;
void addStyleClassRecursive&lt;Wt::WObject, Arguments...&gt;(Wt::WObject *c, Arguments... arg)
{
    for (unsigned int i=0; i&lt;c-&gt;children().size(); ++i)
    {
        addStyleClassRecursive(c-&gt;children()[i], arg...);
    }
}
</code></pre>

<p>Now the compiler complains about </p>

<pre><code>non-type partial specialization 'addStyleClassRecursive&lt;Wt::WObject, Arguments ...&gt;' is not allowed
 void addStyleClassRecursive&lt;Wt::WObject, Arguments...&gt;(Wt::WObject *c, Arguments... arg);
                                                                                        ^
</code></pre>

<p>So can anyone point out how to attain the required result?</p>