title: Range-based for loop on a dynamic array?
body: <p>There is a range-based for loop with the syntax:</p>
  
  <pre><code>for(auto&amp; i : array)
  </code></pre>
  
  <p>It works with constant arrays but not with pointer based dynamic ones, like </p>
  
  <pre><code>int *array = new int[size];
  for(auto&amp; i : array)
     cout&lt;&lt; i &lt;&lt; endl;
  </code></pre>
  
  <p>It gives errors and warnings about failure of substitution, for instance:</p>
  
  <blockquote>
    <p>Error] C:\Users\Siegfred\Documents\C-Free\Temp\Untitled2.cpp:16:16: error: no matching function for call to 'begin(int*&amp;)'</p>
  </blockquote>
  
  <p>How do I use this new syntax with dynamic arrays?</p>