title: std::copy from memory buffer to vector
body: <p>I am trying to copy binary data from a mem buffer to a vector.</p>
  
  <p>Please let me know what is wrong with the folloowing attempts </p>
  
  <p>each time I am getting vector size as 0</p>
  
  <pre><code>int AhaConnectAPI::unpackDataArray(uint8_t* src, vector&lt;uint64_t&gt; dest, uint32_t destvectorSize, int offset)
  {
  
      cout&lt;&lt;"\nstd::copy";
      std::copy(src + offset, src + offset + sizeof(uint64_t) * length, back_inserter(dest));
      return length * 8;
  }
  </code></pre>
  
  <p>or</p>
  
  <pre><code>int AhaConnectAPI::unpackDataArray(uint8_t* src, vector&lt;uint64_t&gt; dest, uint32_t destvectorSize, int offset)
  {
  
      uint64_t element;
  
      for(unsigned int i = 0 ; i&lt;destvectorSize; i++)
      {
           offset = unpackData(src, element, offset);
           dest.push_back(element);
      }
  
      return dest.size() * sizeof(uint64_t);
  
  }
  </code></pre>