title: how overload operator<< for an array in C++?
body: <p>I'm trying to do it this way:</p>
  
  <pre><code>template &lt;typename T&gt;
  ostream &amp;operator&lt;&lt;(ostream &amp;os, T &amp;arr)
  { /*...*/ }
  </code></pre>
  
  <p>But can <code>T</code> represent an array? Is it correct to overload the <code>&lt;&lt;</code> operator for an array?</p>
  
  <hr>
  
  <p><strong>EDIT:</strong></p>
  
  <p>According to Kerrek SB's advice, here is my implementation for <code>&lt;&lt;</code>:</p>
  
  <pre><code>template &lt;typename T, unsigned int N&gt;
  ostream &amp;operator&lt;&lt;(ostream &amp;os, const T (&amp;arr)[N])
  {
      int i;
      for(i = 0; i &lt; N; i++)
          os &lt;&lt; arr[i] &lt;&lt; " ";
      os &lt;&lt; endl;
      return os;
  }
  </code></pre>
  
  <p>Is my implementation right? I got a compilation error.</p>