What's the cleanest way code-wise to return a statically sized array from an object?
<p>I have a situation where a class holds a vector of constant size 5.  I need the data from the vector as an array of size 5 as our std::vector implementation doesn't appear to use contiguous memory (please don't argue about that, I know it should and we've checked it to death).  The contiguous memory block is required so we can uuencode/uudecode the memory block easily (those turn an arbitrary memory block into a string).</p>

<p>I'm finding it difficult to return a statically sized array.  I can do it by reference or I can do it by wrapping a statically sized array in a structure - but both are a little agitating.  By reference requires the calling code to declare the array first and pass it in to the code, and the other option requires that I make an extra structure just for this purpose.</p>

<pre><code>class A {
    public:
        /*return type*/ GetVectorAsArray(/*params*/) { /* implementation */ }

    private:
        std::vector&lt;X&gt; m_vec;
};
</code></pre>

<p>So, assuming I need to call GetVectorAsArray, what's the cleanest way to return the 5 values in m_vec to the calling code?  You can put whatever you want in return type or params and implementation.</p>
