Use std::copy to copy two bytes from a char array into an unsigned short
<p>I have a binary array <code>char buffer[N];</code> which contains two bytes to be interpreted as an unsigned short at its beginning and am currently extracting those by doing</p>

<pre><code>unsigned short size= 0;
memcpy((char *) &amp;size, buffer, sizeof(unsigned short));
</code></pre>

<p>I would however like to use std::copy for this. Is this possible?</p>

<p>Attempts like </p>

<pre><code>std::copy(buffer, buffer+sizeof(unsigned short), (char *) &amp;size);
</code></pre>

<p>have resulted in various errors when compiling..</p>

<p><strong>Edit:</strong> Sorry, I was in a hurry and forgot:
This is on a Ubuntu GNU/Linux system with gcc 4.4.3. The error message was <code>Error: Invalid conversion from ‘char*’ to ‘char’</code>.</p>
