title: Array size deduction
body: <p>Following an example from Scott Meyer's "Modern C++", I'd exploit <code>std::array</code> size deduction with templates. I'm stumbled trying to compile my <code>myUsage</code> function usage.</p>
  
  <pre><code>#include &lt;array&gt;
  #include &lt;iostream&gt;
  
  template &lt;typename T, std::size_t N&gt;
  constexpr std::size_t arraySize(T (&amp;) [N]) noexcept
  {
          return N;
  }
  
  void scottUsage()
  {
          int b[5];
          std::array&lt;short, arraySize(b)&gt; c;
          std::cout &lt;&lt; arraySize(b) &lt;&lt; " = " &lt;&lt; c.size() &lt;&lt; "\n";
  }
  
  template &lt;typename T, std::size_t N&gt;
  void myUsage(T &amp; arr [N])
  {
          for (auto i=0; i&lt;arraySize(arr); i++)
                  std::cout &lt;&lt; arr[i] &lt;&lt; "\t";
  }
  
  int main()
  {
          scottUsage();
  
          int a[7];
          myUsage(a);
  }
  
  </code></pre>
  
  <p>So two questions arise:</p>
  
  <ol>
  <li>(<em>side question</em>) What's <code>(&amp;)</code> for? Removing would trigger <code>error: creating array of references</code>, which it seems to be forbidden</li>
  <li>What's wrong with <code>myUsage</code> signature?</li>
  </ol>