What I'm trying to achieve is getting only a portion of a rectangular array made using vectors of vectors of integers, with the result also being rectangular.
I already managed something similar using a 1D vector of integers, using this function:
typedef std::vector<int> int1D;
typedef std::vector<int1D> int2D;
int1D Copy1D(int1D array, int startIndex, int endIndex)
{
return int1D(array.begin() + startIndex, array.begin() + endIndex + 1);
}
However, I can't seem to use the same approach for a 2D version of this function, as it then ends up selecting all the elements of the 1D vectors that are in the chosen range, but can't select the range chosen for within the 1D vectors.
I'm also open to trying out using a 1D vector as a 2D vector as described here, even more so if it is better in any way. However, for the sake of having options, I'd like efficient ways of doing both approaches.