How to copy part of one vector to another in c++
<p>I have a matirx sotred in a vector in row major order. For example:</p>

<pre><code>1 5 9 13 2 6 10 14 3 7 11 15 4 8 12 16
</code></pre>

<p>I have a function</p>

<pre><code>void transformatrix( vector&lt;uint32&gt; *vector_a)
</code></pre>

<p>that performs some modifications to a matrix. I need to pass part of a vector to that function. For example I need to pass</p>

<pre><code>2 6 10 14
</code></pre>

<p>What I'm thinking about is to create a copy of a vector, pass it to a function:</p>

<pre><code>vector&lt;int&gt; v2(v.begin() + x, v.begin() + x + y);
</code></pre>

<p>But it would be better to create another vector that will be just a pointer to original vector as I always access elements sequentially.</p>

<p>Is there any way how to create another vector without coping data?</p>