title: How to copy an int to a boost/std::array of char?
body: <p>What is the most simple and efficient why to copy an int to a boost/std::array?</p>
  
  <p>The following seems to work, but I'm not sure if this is the most appropriate way to do it:</p>
  
  <pre><code>  int r = rand();
    boost::array&lt;char, sizeof(int)&gt; send_buf;
    std::copy(reinterpret_cast&lt;char*&gt;(&amp;r), reinterpret_cast&lt;char*&gt;(&amp;r + sizeof(int)), &amp;send_buf[0]);
  </code></pre>