title: Put bytes from unsigned char array to std::string using memcpy() function
body: <p>I have std::string variable. And I need to put some bytes from array of unsigned chars to it. I know the first byte and the the legth.</p>
  
  <p>I can use the std::string::assign function. I've done it.</p>
  
  <p>But I want to solve that issue in a right way using the memcpy function.</p>
  
  <pre><code>std::string newString;
  memcpy(&amp;newString, &amp;bytes[startIndex], length);
  </code></pre>
  
  <p>I know it is wrong. I have researched and found some ideas using std::vector.</p>
  
  <p>Please help me to find the most elegant solution for this issue.</p>