What is the correct way to insert columns in a 2D vector of pointers?
<p>I'm using a 2D array as board for a board game I am making. The members are pointers to objects of the type "Tile". The indices are x and y, which denote the horizontal and vertical position respectively.
In the Board class, it looks like this.</p>

<pre><code>vector&lt;vector&lt;Tile*&gt; &gt; playGround;
</code></pre>

<p>The problem is that, as the game progresses, tiles are added to playGround, and the vector has to be able to expand in case a new tile's position requires this. I've been trying to add rows to the top, and to add columns to the left. I've tried to use the insert() function, and that's where my problem is.</p>

<p>Right now my code looks like this:</p>

<pre><code>void Board::addRowTop()
{
    Tile* t;
    int i = 0;
    maxY++;
    for ( ; i &lt; maxX ; i++ )
        playGround[i].insert(0, t);
}
</code></pre>

<p>Don't mind the maxX and maxY variables; they're irrelevant to the subject at hand. The problem is: insert(0, t) obviously does not work, because "t" is not the data type that is expected by the function.</p>

<p>My question is simple: What exactly does the second argument of insert() need to be in order to solve this problem? I've looked around on google, but I couldn't seem to find the right answer.</p>

<p>Thanks a lot in advance.</p>
