title: Using template for array constructor as a function return type
body: <p>I'm a little new to the template function in c++ and encounter a problem that I cannot find any result by googling.</p>
  
  <p>Trying to use a template here for generating different dimensions of arrays. The code is shown below:</p>
  
  <pre><code> template &lt;size_t T&gt; 
   vector&lt;array&lt;float, T&gt;&gt; poissonSample(size_t T, float r) {
      array&lt;float, T&gt; x_min, x_max;
  
      return samples;
    }
  </code></pre>
  
  <p>The definition of the function seems fine, however, when I try to call the function with something like:</p>
  
  <pre><code>poissonSample(4, 0.3f);
  </code></pre>
  
  <p>The compiler will report "no instance of function template matches the argument list.</p>
  
  <p><a href="https://i.stack.imgur.com/2wCix.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2wCix.png" alt="enter image description here"></a></p>
  
  <p>What is the problem here?</p>