title: Copying to std::chrono::milliseconds with memcpy() gives error -Werror=class-memaccess
body: <p>For this code:</p>
  
  <pre><code>std::array&lt;unsigned char, 6&gt; myArray = {123, 123, 112, 0, 15};
  std::chrono::milliseconds dest{0};
  memcpy(&amp;dest, &amp;myArray, 5);
  </code></pre>
  
  <p>Gcc gives the following error:</p>
  
  <pre class="lang-none prettyprint-override"><code>warning: 'void* memcpy(void*, const void*, size_t)' copying an object of type 'std::chrono::milliseconds'
  {aka 'struct std::chrono::duration&lt;long int, std::ratio&lt;1, 1000&gt; &gt;'}
  with 'private' member 'std::chrono::duration&lt;long int, std::ratio&lt;1, 1000&gt; &gt;::__r'
  from an array of 'struct std::array&lt;unsigned char, 6&gt;';
  use assignment or copy-initialization instead [-Wclass-memaccess]
  </code></pre>
  
  <p>What would be the best way to handle this when I need to copy only 5 bytes from array and not the whole array?</p>
  
  <p>Here is my full code:</p>
  
  <pre><code>std::array&lt;uint8_t, 6&gt; myArray = {0};
  uint32_t time = 500000000;
  
  memcpy(&amp;myArray, &amp;time, 4);
  std::chrono::milliseconds ret{0};
  
  memcpy(&amp;ret, &amp;myArray, 4);
  </code></pre>
  
  <p>So im trying to get same value in <code>ret</code> as the one in <code>time</code></p>