title: Wrap dynamic array with shared_ptr by make_shared
body: <p>I want to write some bytes to an array. To make use of modern C++ I have decided to use a smart pointer.</p>
  
  <pre><code>#include &lt;memory&gt;
  #include &lt;cstdint&gt;
  
  using namespace std;
  
  void writeUint32_t(uint32_t value, unsigned char* p){
      *p     = static_cast&lt;unsigned char&gt;((value &gt;&gt; 24) &amp; 0xFF);
      *(++p) = static_cast&lt;unsigned char&gt;((value &gt;&gt; 16) &amp; 0xFF);
      *(++p) = static_cast&lt;unsigned char&gt;((value &gt;&gt;  8) &amp; 0xFF);
      *(++p) = static_cast&lt;unsigned char&gt;((value      ) &amp; 0xFF);
  }
  
  int main(){
      auto buf = make_shared&lt;unsigned char[]&gt;(512);
      uint32_t data = 1234;
      writeUint32_t(data, buf.get() + 8);
  }
  </code></pre>
  
  <p>However, I am receiving the following compilation error:</p>
  
  <pre><code>u.cpp:15:37: error: invalid use of array with unspecified bounds
   writeUint32_t(data, buf.get() + 8);
                                   ^
  u.cpp:15:38: error: cannot convert ‘unsigned char (*)[]’ to ‘unsigned char*’ for argument ‘2’ to ‘void writeUint32_t(uint32_t, unsigned char*)’
   writeUint32_t(data, buf.get() + 8);
  </code></pre>
  
  <p>I am using <code>g++ (Ubuntu 5.4.0-6ubuntu1~16.04.2) 5.4.0 20160609</code>
  Is there a way to use smart pointers in such a situation?</p>