title: sort algorithm compiler error with dynamic array
body: <p>I'm having difficulty getting std::begin() to work with a dynamically allocated array (pointer), where it seems to work fine with a stack-allocated one.</p>
  
  <p>This works:    </p>
  
  <pre><code>int numbers[100];
  
  // Fill array with numbers
  
  std::sort(std::begin(numbers), std::end(numbers));
  </code></pre>
  
  <p>This doesn't</p>
  
  <pre><code>int* numbers = new int[10000000];
  
  // Fill array with numbers
  
  std::sort(std::begin(numbers), std::end(numbers));
  </code></pre>
  
  <p>Here's the resulting error.</p>
  
  <pre><code>ptests.cpp:120:33: error: no matching function for call to ‘begin(int*&amp;)’
       std::sort(std::begin(numbers), std::end(numbers));
                                   ^
  ptests.cpp:120:33: note: candidates are:
  In file included from /usr/include/c++/4.8/utility:74:0,
                   from /usr/include/c++/4.8/algorithm:60,
                   from ptests.cpp:1:
  /usr/include/c++/4.8/initializer_list:89:5: note: template&lt;class _Tp&gt; constexpr const _Tp* std::begin(std::initializer_list&lt;_Tp&gt;)
       begin(initializer_list&lt;_Tp&gt; __ils) noexcept
       ^
  /usr/include/c++/4.8/initializer_list:89:5: note:   template argument deduction/substitution failed:
  ptests.cpp:120:33: note:   mismatched types ‘std::initializer_list&lt;_Tp&gt;’ and ‘int*’
       std::sort(std::begin(numbers), std::end(numbers));
                                   ^
  In file included from /usr/include/c++/4.8/string:51:0,
                   from /usr/include/c++/4.8/random:41,
                   from /usr/include/c++/4.8/bits/stl_algo.h:65,
                   from /usr/include/c++/4.8/algorithm:62,
                   from ptests.cpp:1:
  /usr/include/c++/4.8/bits/range_access.h:48:5: note: template&lt;class _Container&gt; decltype (__cont.begin()) std::begin(_Container&amp;)
       begin(_Container&amp; __cont) -&gt; decltype(__cont.begin())
  </code></pre>
  
  <p>Would it be possible to cast the dynamic pointer to the type begin() expects? Any advice would be appreciated!</p>