title: Combining multiple templates in each other
body: <p>How can I combine multiple types in one function like</p>
  
  <pre><code>template &lt; typename T1 &gt;
  template &lt; typename T2 &gt;
  T2 average( T1 v1, T1 v2, T1 v3 )
  {
      T averageValue;
      cout&lt;&lt;"after averageValue; v1: "&lt;&lt;typeid(v1).name()
          &lt;&lt;" v2: "&lt;&lt;typeid(v2).name()
          &lt;&lt;" v3: "&lt;&lt;typeid(v3).name()
          &lt;&lt;" averageValue: "&lt;&lt;typeid(averageValue).name();
      averageValue =(v1+v2+v3)/.3;
      cout&lt;&lt;"\nAfter averageValue =(v1+v2+v3)/3; averageValue: "&lt;&lt;typeid(averageValue).name();
      return averageValue;
  };
  </code></pre>
  
  <p>I know that the code won't compile but I want to know if there is any way to do something like that</p>