 <p>Some close alternatives are <code>std::vector</code> and <code>std::array</code>. </p> <p>If you want to use an array of bytes, usually <code>uint8_t</code>, you will need to pass the array to functions, <em>as well as the capacity and the number of elements in the array</em>. </p> <p>The issue is that when arrays are passed to functions, the array decays down to a pointer to the first element, without any capacity information. </p> <p>There are no facilities to prevent you from indexing beyond the limits (capacity) of the array. This is why <code>std::vector</code> is a safer choice.</p>