title: Template Parameter variable / Dynamic Instantiation
body: <p>I am an absolutely beginner in C++, so I really would appreciate your help!</p>
  
  <p>I am currently implementing a Matrix Class with Template Parameters for datatype, dimension width and dimension height. </p>
  
  <pre><code>template &lt;class T, int rows, int columns&gt; class Matrix
  </code></pre>
  
  <p>In the multiplication function I have to create the result matrix (Height Matrix A x Width Matrix B), but I receive the error "template value cannot appear in a constant expression". </p>
  
  <pre><code>// overload * for matrix multiplication 
     template &lt;class T, int rows, int columns&gt;
     Matrix&lt;T, rows, columns&gt; operator*(Matrix&lt;T, rows, columns&gt; a, Matrix&lt;T, rows, columns&gt; b) {
       Matrix &lt;T, rows, columns&gt; result = new Matrix&lt;T, a-&gt;height, b-&gt;width&gt;;
  // make multiplication here
  </code></pre>
  
  <p>Any ideas how to make a new Matrix with the given type and the height from A resp. width from B?</p>
  
  <p>Thank you so much!</p>