No instance of function template matches the argument list error
<p>I am not sure why I am getting this error of argument list mismatch. The function template instantiation seems to match the one in main...
Can you tell me what's wrong please?
Here is my code:</p>

<pre><code>    //using decltype operator

#include &lt;iostream&gt;
#include &lt;typeinfo&gt;

using std::cout;
using std::endl;

template&lt;class T1, class T2&gt; 
auto product( T1 v1[], T2 v2[], size_t count ) -&gt;decltype( v1[0] * v2[0] ) {
    decltype( v1[0] * v2[0] ) sum( 0 );
    for( size_t i = 0; i &lt; count; i++ ) sum += v1[i] * v2[i];
    return sum;
}

int main ( void ) {
    double x[] =   { 100.5, 99.5, 88.7, 77.8 };
    short  y[] =   { 3, 4, 5, 6 };
    long   z[] =   { 11L, 12L, 13L, 14L };
    size_t n = 4;
    cout &lt;&lt; "Result type is "&lt;&lt; typeid( product ( x, y, n ) ).name() &lt;&lt; endl;
    cout &lt;&lt; "Result  is " &lt;&lt; product ( x, y, n ) &lt;&lt; endl;
    cout &lt;&lt; "Result type is " &lt;&lt; typeid( product ( z, y, n ) ).name() &lt;&lt; endl;
    cout &lt;&lt; "Result is " &lt;&lt; product ( z, y, n ) &lt;&lt; endl;

    return 0;
}
</code></pre>
