title: C++ equivalent to Java's System.arraycopy
body: <p>I'm trying to port some Java code of mine that makes heavy use of the System.arraycopy method and want to know if there is an equivalent in C++.  Basically I want to have n byte arrays and combine them into one big array.  Each of the initial arrays can be of variable length, so I don't want to go through the hoops of calculating the end arrays length and then populating the entire array one position at a time as this feels rather slow and I'm sure this operation has been optimized.  However, I can't find what this optimization is (although I may be making this more complicated than it should be).</p>
  
  <p>Here's some pseudo (Java) code to illustrate what I want to do.</p>
  
  <pre><code>byte[] a = new byte[]{0x00, 0x01, 0x02};
  byte[] b = new byte[][0x03, 0x04, 0x05];
  byte[] ab = new byte[a.length+b.length];
  System.arraycopy(ab, 0, a, 0, a.length);
  System.arraycopy(ab, a.length+1, b, 0, b.length);
  //Now, I would expect ab to look like {0x00, 0x01, 0x02, 0x03, 0x04, 0x05}
  </code></pre>
  
  <p>Like I said, this may be simple in C++, but I will be doing this many, many times and want to make sure I'm doing it as efficiently as possible.</p>