I want to delete an element in a 2d vector, say [1][1] in "Field", which is a 4x5 vector
I tried
Field.erase([1][1]);
I know that for a 1d vector, I would just do
Field.erase (Field.begin()+1)
but what about for 2d vectors?
Last edited on
Also note that the above will only remove the element from Field[1].
Field[0], Field[2], etc will still have all 4 (5?) elements. So you wouldn't have a clean grid anymore, you'd have a jagged 2D array.
Last edited on